use of io.joynr.communications.exceptions.JoynrHttpException in project joynr by bmwcarit.
the class LongPollingMessagingDelegate method openChannel.
/*
* Opens a channel for long polling.
*
* @param ccid
* the ID of the channel
* @param atmosphereTrackingId
* the tracking ID
* @return
* @throws JoynrHttpException
* if no channel with the given ID was found (e.g. because it
* wasn't created before) or if the tracking ID wasn't set
*/
public Broadcastable openChannel(String ccid, String atmosphereTrackingId) {
throwExceptionIfTrackingIdnotSet(atmosphereTrackingId);
log.debug("GET Channels open long poll channelId: {} trackingId: {}", ccid, atmosphereTrackingId);
// NOTE: as of Atmosphere 0.8.5: even though the parameter is set
// not to create the broadcaster if not
// found, if the
// broadcaster is found, but set to "destroyed" then it is recreated
// TODO when is a broadcaster "destroyed" ???
Broadcaster broadcaster = BroadcasterFactory.getDefault().lookup(BounceProxyBroadcaster.class, ccid, false);
if (broadcaster == null) {
log.error("no broadcaster registered for channel {}", ccid);
// broadcaster not found for given ccid
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_CHANNELNOTFOUND);
}
// in the cache
return new Broadcastable(broadcaster);
}
use of io.joynr.communications.exceptions.JoynrHttpException in project joynr by bmwcarit.
the class MonitoringServiceRestAdapter method reportPerformance.
/**
* Refreshes the performance measures of a bounce proxy instance, e.g.
* active long polls.
*
* @param bpId
* the identifier of the bounce proxy
* @param performanceMap
* key-value pairs of performance measures
* @return empty response
*/
@POST
@Path("/{bpid: ([A-Z,a-z,0-9,_,\\-]+)(\\.)([A-Z,a-z,0-9,_,\\-]+)}/performance")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.TEXT_PLAIN })
public Response reportPerformance(@PathParam("bpid") String bpId, Map<String, Integer> performanceMap) {
if (!monitoringService.isRegistered(bpId)) {
throw new JoynrHttpException(Status.BAD_REQUEST, JoynrBounceProxyControlErrorCode.BOUNCEPROXY_UNKNOWN, "bounce proxy '" + bpId + "'");
}
PerformanceMeasures performanceMeasures = new PerformanceMeasures();
performanceMeasures.addMeasures(performanceMap);
monitoringService.updatePerformanceMeasures(bpId, performanceMeasures);
return Response.noContent().build();
}
Aggregations