Hi Jan,

Thanks for the report. Could you enter an issue in our tracker to keep track
on this? Precise instructions to run the client-side tools/lib causing the
problem would help a lot.
http://www.restlet.org/community/issues

Regarding the BrokenCyclicBarrier causing a potential infinite loop, I just
fixed the issue in SVN trunk. However, the is probably something else wrong
to put the internal HTTP server in such as state. This needs to be
reproduced on our side in order to be fixed. 

Best regards,
Jerome
--
http://www.restlet.org
http://twitter.com/#!/jlouvel



-----Message d'origine-----
De : Jan M [mailto:[email protected]] 
Envoyé : samedi 1 octobre 2011 20:24
À : [email protected]
Objet : Fwd: "Unable to block the thread at the cyclic
barrier"/java.util.concurrent.TimeoutException exception

Hi there,

to enable outside interaction and monitoring for a tool i wrote, i embedded
restlet so server some status information in json form.

while everything worked fine, when i queries using a browser, i got some
hickups when using pythin urllib to make the url request.

curl worked fine too, but apache bench did not work either.

as I am not experienced at all, i wanted some feedback on that issue. I am
now using http client in python, which solved the problem there.

when I do: urllib.request.urlopen('http://localhost:8182').read()

i get the following issue/exception thrown:

Unable to block the thread at the cyclic barrier

java.util.concurrent.TimeoutException
at java.util.concurrent.CyclicBarrier.dowait(CyclicBarrier.java:222)
at java.util.concurrent.CyclicBarrier.await(CyclicBarrier.java:399)
at
org.restlet.util.SelectionRegistration.block(SelectionRegistration.java:173)
at
org.restlet.engine.io.NbChannelInputStream.onFill(NbChannelInputStream.java:
226)
at org.restlet.engine.io.Buffer.process(Buffer.java:594)
at
org.restlet.engine.io.NbChannelInputStream.read(NbChannelInputStream.java:30
9)
at java.io.InputStream.read(InputStream.java:85)
at org.restlet.engine.io.BioUtils.exhaust(BioUtils.java:235)
at
org.restlet.representation.Representation.exhaust(Representation.java:244)
at
org.restlet.engine.connector.ServerOutboundWay.onCompleted(ServerOutboundWay
.java:172)
at
org.restlet.engine.connector.HttpServerOutboundWay.onCompleted(HttpServerOut
boundWay.java:114)
at
org.restlet.engine.connector.OutboundWay.processIoBuffer(OutboundWay.java:40
7)
at org.restlet.engine.connector.Way.onSelected(Way.java:409)
at
org.restlet.util.SelectionRegistration.onSelected(SelectionRegistration.java
:284)
at
org.restlet.engine.connector.Connection.onSelected(Connection.java:579)
at
org.restlet.util.SelectionRegistration.onSelected(SelectionRegistration.java
:284)
at
org.restlet.engine.connector.ConnectionController.onSelected(ConnectionContr
oller.java:187)
at
org.restlet.engine.connector.ServerConnectionController.onSelected(ServerCon
nectionController.java:97)
at
org.restlet.engine.connector.ConnectionController.selectKeys(ConnectionContr
oller.java:260)
at
org.restlet.engine.connector.ConnectionController.doRun(ConnectionController
.java:145)
at org.restlet.engine.connector.Controller.run(Controller.java:155)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.ja
va:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:9
08)
at java.lang.Thread.run(Thread.java:662)


My Code to start the server:

         try {
             new Server(Protocol.HTTP, 8182,
JobStatusResource.class).start();
         } catch (Exception ex) {
             
Logger.getLogger(PGMonitor.class.getName()).log(Level.SEVERE, null, ex);
         }

My Server Resource class: In my test case no jobs are running, otherwise I
have one scheduledthreadpool executor per server i connect to with ~4 tasks
waiting at different intervals.

public class JobStatusResource extends ServerResource {

     @Get
     public String overview() {
         System.out.println("got request");
         String result = "";
         for( AGatherer g : PGMonitor.getJobList() ) {
             if(!result.equals("")) result += ",";
             result += "{ \"name\": \"" + g.getName() + "\",
\"lastRun\": " + g.getLastRunFinishedInSeconds() + ", \"runtime\" :" +
(g.getLastRunFinishedInSeconds()-g.getLastRunInSeconds())+ "} " ;
         }
         System.out.println("finished building content");
         return "{ \"current_time\" : " +
System.currentTimeMillis()/1000 +" , \"jobs\": [" + result + "] }";
     }
}

any feedback on what I am doing wrong or should change is appreciaded.

thanks for your efforts,
Jan

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=28486
90

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2849864

Reply via email to