/** * Execute this Context using the Controller's Pipeline * @param contextTask {@link ContextTask}, which will be * executed by {@link Pipeline} * @throws {@link PipelineFullException} */ public void execute(ContextTask contextTask) throws PipelineFullException { execute(contextTask, true); }
/** * Invoke a {@link AsyncQueueWriter} * @param context {@link Context} * @throws java.io.IOException */ protected void invokeAsyncQueueWriter(Context context) throws IOException { AsyncQueueWriterContextTask task = AsyncQueueWriterContextTask.poll(); task.setAsyncQueueWriter(asyncQueueWriter); try { context.execute(task); } catch (PipelineFullException ex) { throw new IOException(ex.getMessage()); } }
/** * Invoke a {@link AsyncQueueReader} * @param context {@link Context} * @throws java.io.IOException */ protected void invokeAsyncQueueReader(Context context) throws IOException { AsyncQueueReaderContextTask task = AsyncQueueReaderContextTask.poll(); task.setAsyncQueueReader(asyncQueueReader); try { context.execute(task); } catch (PipelineFullException ex) { throw new IOException(ex.getMessage()); } }
/** * Execute this Context using the Controller's Pipeline * @throws {@link PipelineFullException} * @deprecated */ public void execute() throws PipelineFullException { // If a IOEvent has been defined, invoke it first and // let its associated CallbackHandler decide if the ProtocolChain // be invoked or not. Object attachment = SelectionKeyAttachment.getAttachment(key); if (ioEvent != null && (attachment instanceof CallbackHandler)) { CallbackHandlerContextTask task = CallbackHandlerContextTask.poll(); task.setCallBackHandler((CallbackHandler) attachment); execute(task); } else { execute(ProtocolChainContextTask.poll()); } }
/** * Invoke a CallbackHandler via a Context instance. * @param context {@link Context} * @throws java.io.IOException */ protected void invokeCallbackHandler(CallbackHandler callbackHandler, Context context) throws IOException { IOEvent<Context>ioEvent = new IOEvent.DefaultIOEvent<Context>(context); context.setIOEvent(ioEvent); // Added because of incompatibility with Grizzly 1.6.0 context.setSelectorHandler(this); try { CallbackHandlerContextTask task = CallbackHandlerContextTask.poll(); task.setCallBackHandler(callbackHandler); boolean isRunInSeparateThread = true; if (callbackHandler instanceof CallbackHandlerDescriptor) { isRunInSeparateThread = ((CallbackHandlerDescriptor) callbackHandler). isRunInSeparateThread(context.getCurrentOpType()); } context.execute(task, isRunInSeparateThread); } catch (PipelineFullException ex) { throw new IOException(ex.getMessage()); } }
Context ctx = pollContext(key, opType); configureContext(ctx,selectorHandler); ctx.execute(ProtocolChainContextTask.poll());
controller.configureContext(ctx, kh.getSuspendableHandler().getSelectorHandler()); ctx.execute(SuspendableContextTask.poll( protocolChain,kh.getThreadAttachment(),nextFilterPosition)); } catch (PipelineFullException ex) {
try{ Context copyContext = Cloner.clone(ctx); copyContext.execute(ProtocolChainContextTask.poll()); copyContext.setPipeline(pipeline); } catch (Throwable t){