Comments (6)
Some logging:
JSONGetter HTTP response problem: http://www.sodexo.fi/ruokalistat/output/daily_json/731/1/1/2013/en?mobileRedirect=false : null, EXCEPTION: java.lang.ClassCastException: org.tantalum.net.json.JSONModel cannot be cast to byte[]
java.lang.ClassCastException: org.tantalum.net.json.JSONModel cannot be cast to byte[]
at org.tantalum.net.json.JSONGetter.exec(JSONGetter.java:58)
at org.tantalum.net.HttpGetter.exec(HttpGetter.java:765)
at org.tantalum.net.json.JSONGetter.exec(JSONGetter.java:58)
at org.tantalum.net.HttpGetter.exec(HttpGetter.java:765)
at org.tantalum.net.json.JSONGetter.exec(JSONGetter.java:58)
at org.tantalum.Task.executeTask(Task.java:858)
at org.tantalum.Worker.run(Worker.java:471)
from tantalum.
Apparently, you get the same exception even with working HTTP connection, i.e. JsonGetter may be broken in general (?).
from tantalum.
Nice catch. The HTTP retry introduces some oddness because it calls exec() directly after a 5sec pause. This makes the normal cancel() logic is slightly skewed.
Updating HttpGetter and all superclasses as follows is the short fix.
if (!success) {
return null;
}
return out;
The alt fix would be to change retry. But for example using a Timer to retry after 5sec is one though. But synchronous retry was done this way to avoid retry break complications with (new HttpGetter("url"...).get())
In general the return value of a failed Task is poorly defined. The next task in chain won't be executed so this mostly does not matter, but cancel() in the context also needs some systematic study to ensure the corner cases are covered.
from tantalum.
I'm also not sure whether JsonGetter being subclass on HttpGetter is optimal design. It could be better if JsonGetter was using HttpGetter instead of inheriting from it.
E.g. when you instantiate JsonGetter, it instantiates HttpGetter and chains itself to it, and only gets the data from "input" parameter in exec()
Edit: ok, that would be contorted design. It should use HttpGetter, but should explicitly launch HttpGetter::exec() and wait for it to complete in its own exec(). "subtasks within tasks" makes a useful FAQ item ;-)
from tantalum.
Yes, JSONGetter creating and getting an HttpGetter has advantages.
One difference vs chain() is with prioritization. HttpGetter shouldn't be in the FASTLANE as it takes so long and we want to keep that one threadpool thread free to be repsonsive even during heavy traffice. Need to think a bit and have a go-through. Leaving as-is for now
from tantalum.
Should be fixed in latest merge to master
from tantalum.
Related Issues (20)
- Fix Linux build HOT 4
- JavaDoc has useless stubs showing HOT 1
- Study: Explicit LWUIT support HOT 1
- PlatformAdapter for JSE HOT 3
- Tantalum Gradle build fails with latest version 1.5 of Gradle HOT 2
- Gradle findbugs output is in XML, could be in HTML HOT 2
- Remove "android stubs" from the main project HOT 5
- AndroidPlatformAdapter missing default ctor, doesn't work
- Agree on "full name" of project HOT 4
- init() call missing from setProgram for Android HOT 1
- Geocoder examples need to be updated
- JsonGetter doesn't survive if Content-Length is missing HOT 5
- Constructor with default priority should be provided HOT 4
- Put initialization in platform specific classses. HOT 8
- Continuous integration for Tantalum HOT 1
- CI for Tantalum HOT 7
- Preprocessing disabled HOT 1
- Promises (research) HOT 1
- Generics (research)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tantalum.