public GravityConfig getGravityConfig() { return gravity.getGravityConfig(); }
@Override public void receive(AsyncMessage message) throws MessageReceivingException { if (message == null) throw new NullPointerException("message cannot be null"); GravityConfig gravityConfig = gravity.getGravityConfig(); receivedQueueLock.lock(); try { if (receivedQueue.size() + 1 > gravityConfig.getMaxMessagesQueuedPerChannel()) throw new MessageReceivingException(message, "Could not queue message (channel's queue is full) for channel: " + this); receivedQueue.add(message); } finally { receivedQueueLock.unlock(); } synchronized (this) { resume(); } }
@Override public void receive(AsyncMessage message) throws MessageReceivingException { if (message == null) throw new NullPointerException("message cannot be null"); GravityConfig gravityConfig = gravity.getGravityConfig(); receivedQueueLock.lock(); try { if (receivedQueue.size() + 1 > gravityConfig.getMaxMessagesQueuedPerChannel()) throw new MessageReceivingException(message, "Could not queue message (channel's queue is full) for channel: " + this); receivedQueue.add(message); } finally { receivedQueueLock.unlock(); } synchronized (this) { resume(); } }
public void onOpen(Connection connection) { this.connection = connection; this.connection.setMaxIdleTime((int)getGravity().getGravityConfig().getChannelIdleTimeoutMillis()); setMaxBinaryMessageBufferSize(connection.getMaxBinaryMessageSize()); connect(); gravity.notifyConnected(this); }
log.warn(e, "Could not send messages to channel: %s (retrying later)", this); GravityConfig gravityConfig = getGravity().getGravityConfig(); if (gravityConfig.isRetryOnError()) { receivedQueueLock.lock();
if (receivedQueue.size() + 1 > gravity.getGravityConfig().getMaxMessagesQueuedPerChannel()) throw new MessageReceivingException(message, "Could not queue message (channel's queue is full) for channel: " + this);
throw new NullPointerException("No channel on connect"); long pollingInterval = gravity.getGravityConfig().getExtra().get("gae/@polling-interval", Long.TYPE, GAE_POLLING_INTERVAL);
@Override public void onWebSocketConnect(Session session) { this.socketSession = session; this.socketSession.setIdleTimeout(getGravity().getGravityConfig().getChannelIdleTimeoutMillis()); setMaxBinaryMessageBufferSize(socketSession.getPolicy().getMaxBinaryMessageBufferSize()); connect(); gravity.notifyConnected(this); log.debug("Channel %s websocket connected %s", getId(), socketSession.isOpen() ? "(open)" : "(closed)"); }
log.warn(e, "Could not send messages to channel: %s (retrying later)", getId()); GravityConfig gravityConfig = getGravity().getGravityConfig(); if (gravityConfig.isRetryOnError()) { receivedQueueLock.lock();
session.setMaxIdleTimeout(channel.getGravity().getGravityConfig().getChannelIdleTimeoutMillis()); channel.onWebSocketConnect(session);