public SelectionKey getSelectionKey() { return context.getSelectionKey(); }
public SelectionKey getSelectionKey() { return context.getSelectionKey(); }
public SelectionKey getSelectionKey() { return context.getSelectionKey(); }
protected Object doCall() throws Exception { SelectionKey selectionKey = context.getSelectionKey(); if (selectionKey == null) { throw new IllegalStateException("SelectionKey could not be null!"); } asyncQueueWriter.onWrite(selectionKey); return null; }
public Object doCall() throws Exception { SelectionKey selectionKey = context.getSelectionKey(); if (selectionKey == null) { throw new IllegalStateException("SelectionKey could not be null!"); } asyncQueueReader.onRead(selectionKey); return null; }
public boolean execute( Context ctx ) throws IOException { Object obj = ctx.removeAttribute( ProtocolParser.MESSAGE ); if( !( obj instanceof Message ) ) throw new IOException( "received message is not valid: " + obj ); final Message incomingMessage = (Message)obj; final SelectionKey selectionKey = ctx.getSelectionKey(); Map<String, Object> piggyback = null; if( selectionKey != null ) { piggyback = new HashMap<String, Object>(); piggyback.put( GrizzlyNetworkManager1_9.MESSAGE_SELECTION_KEY_TAG, selectionKey ); } networkManager.receiveMessage( incomingMessage, piggyback ); return false; }
/** * Configure {@link InputReader} * @param {@link InputReader} */ protected void configureByteBufferInputStream( InputReader inputStream, Context context, HttpWorkerThread workerThread) { inputStream.setSelectionKey(context.getSelectionKey()); inputStream.setSecure(false); }
/** * Configure {@link ProcessorTask}. */ protected void configureProcessorTask(ProcessorTask processorTask, Context context, HttpWorkerThread workerThread, Interceptor handler) { SelectionKey key = context.getSelectionKey(); processorTask.setSelectionKey(key); processorTask.setSocket(((SocketChannel) key.channel()).socket()); if (processorTask.getHandler() == null){ processorTask.setHandler(handler); } }
protected void afterCall() { SelectionKey currentKey = context.getSelectionKey(); SelectionKeyHandler selectionKeyHandler = context. getSelectorHandler().getSelectionKeyHandler(); selectionKeyHandler.postProcess(currentKey); }
protected void beforeCall() { SelectionKey currentKey = context.getSelectionKey(); SelectionKeyHandler selectionKeyHandler = context. getSelectorHandler().getSelectionKeyHandler(); selectionKeyHandler.process(currentKey); }
@Override public void onRead(IOEvent<Context> ioEvent) { // We don't expect any read, so if any data comes - we suppose it's "close" notification final Context context = ioEvent.attachment(); final SelectionKey selectionKey = context.getSelectionKey(); // close the channel context.getSelectorHandler().addPendingKeyCancel(selectionKey); }
/** * Configure {@link SSLProcessorTask}. */ protected void configureProcessorTask(ProcessorTask processorTask, Context context, HttpWorkerThread workerThread, Interceptor handler, InputStream inputStream) { SelectionKey key = context.getSelectionKey(); processorTask.setSelectionKey(key); processorTask.setSocket(((SocketChannel) key.channel()).socket()); processorTask.addTaskListener(this); processorTask.setInputStream(inputStream); processorTask.setHandler(handler); }
/** * Configure {@link ProcessorTask}. */ protected void configureProcessorTask(ProcessorTask processorTask, Context context, StreamAlgorithm streamAlgorithm) { SelectionKey key = context.getSelectionKey(); processorTask.setSelectorHandler(context.getSelectorHandler()); processorTask.setSelectionKey(key); processorTask.setSocket(((SocketChannel) key.channel()).socket()); if (processorTask.getStreamAlgorithm() == null){ processorTask.setStreamAlgorithm(streamAlgorithm); } }
/** * {@inheritDoc} */ @Override protected void configureInputBuffer(InputReader inputStream, Context context, HttpWorkerThread workerThread) { inputStream.setSelectionKey(context.getSelectionKey()); final SSLEngine engine = workerThread.getSSLEngine(); inputStream.setSslEngine(engine); swapEncryptInBuffer(inputStream, workerThread, engine); }
public void onConnect(IOEvent<Context> ioEvent) { SelectionKey key = ioEvent.attachment().getSelectionKey(); finishConnect(key); getController().registerKey(key,SelectionKey.OP_WRITE, protocol); } public void onRead(IOEvent<Context> ioEvent) {}
/** * Configure {@link com.sun.grizzly.ssl.SSLProcessorTask}. */ protected void configureProcessorTask(ProcessorTask processorTask, Context context, StreamAlgorithm streamAlgorithm, InputStream inputStream) { SelectionKey key = context.getSelectionKey(); processorTask.setSelectionKey(key); processorTask.setSelectorHandler(context.getSelectorHandler()); processorTask.setSocket(((SocketChannel) key.channel()).socket()); processorTask.setTaskListener(this); processorTask.setInputStream(inputStream); processorTask.setStreamAlgorithm(streamAlgorithm); }
/** * Configure {@link InputReader}. */ protected void configureByteBufferInputStream( InputReader inputStream, Context context, HttpWorkerThread workerThread) { inputStream.setSelectionKey(context.getSelectionKey()); inputStream.setByteBuffer(workerThread.getByteBuffer()); inputStream.setSecure(isSecure()); }
/** * {@inheritDoc} */ @Override protected void configureByteBufferInputStream( InputReader inputStream, Context context, HttpWorkerThread workerThread) { ((SSLAsyncStream) inputStream).setSslEngine(workerThread.getSSLEngine()); ((SSLAsyncStream) inputStream).setInputBB(workerThread.getInputBB()); inputStream.setSelectionKey(context.getSelectionKey()); }
/** * Configure {@link InputReader}. */ protected void configureInputBuffer(InputReader inputStream, Context context, HttpWorkerThread workerThread) { inputStream.recycle(); inputStream.setSelectionKey(context.getSelectionKey()); inputStream.setByteBuffer(workerThread.getByteBuffer()); inputStream.setSecure(isSecure()); }
/** * Configure {@link InputReader}. */ @Override protected void configureInputBuffer(InputReader inputStream, Context context, HttpWorkerThread workerThread) { // Save the buffer before recycle final ByteBuffer associatedBuffer = inputStream.getByteBuffer(); inputStream.recycle(); // Restore the buffer inputStream.setByteBuffer(associatedBuffer); inputStream.setSelectionKey(context.getSelectionKey()); inputStream.setSecure(isSecure()); }