Package com.sun.grizzly.util

Examples of com.sun.grizzly.util.WorkerThread


        newbuf.put(_buffer);
        _buffer = newbuf;
        _buffer.position(savepos-_position);
        _position = 0;

        WorkerThread workerThread = (WorkerThread) Thread.currentThread();
        workerThread.setByteBuffer(_buffer);

        if (_logger.isLoggable(Level.FINEST)) {
            _logger.log(Level.FINEST, "leaving: _position="+_position+", _buffer="+_buffer);
        }
    }
View Full Code Here


            throw new IllegalStateException(StompServer.getStompBridgeResources().getKString(
                  StompBridgeResources.X_UNEXPECTED_PARSER_POSITION, _position, _buffer.position()));
        }

        ByteBuffer newbuf = ByteBuffer.allocate(_buffer.capacity());
        WorkerThread workerThread = (WorkerThread) Thread.currentThread();
        workerThread.setByteBuffer(newbuf);
        _buffer = newbuf;
        _position = 0;

        if (_logger.isLoggable(Level.FINEST)) {
            _logger.log(Level.FINEST, "leaving: _position="+_position+", _buffer="+_buffer);
View Full Code Here

    private StompProtocolHandler getStompProtocolHandler(Context ctx) {

        StompProtocolHandler sph = null;
        AttributeHolder attr = ctx.getAttributeHolderByScope(Context.AttributeScope.CONNECTION);
        if (attr == null) {
            WorkerThread workerThread = (WorkerThread)Thread.currentThread();
            attr = workerThread.getAttachment();
            ctx.getSelectionKey().attach(attr);
        }
        sph = (StompProtocolHandler)attr.getAttribute(STOMP_PROTOCOL_HANDLER_ATTR);
        if (sph == null) {
            sph = new StompProtocolHandler(_bc, _jmsprop);
View Full Code Here

    private StompProtocolHandler getStompProtocolHandler(Context ctx) {

        StompProtocolHandler sph = null;
        AttributeHolder attr = ctx.getAttributeHolderByScope(Context.AttributeScope.CONNECTION);
        if (attr == null) {
            WorkerThread workerThread = (WorkerThread)Thread.currentThread();
            attr = workerThread.getAttachment();
            ctx.getSelectionKey().attach(attr);
        }
        sph = (StompProtocolHandler)attr.getAttribute(STOMP_PROTOCOL_HANDLER_ATTR);
        if (sph == null) {
            sph = new StompProtocolHandler(_bc, _jmsprop);
View Full Code Here

            this.parser = parser;
        }
       
        public boolean execute(Context ctx) throws IOException
        {
            WorkerThread workerThread =
                    (WorkerThread)Thread.currentThread();

            // Use Jetty's ByteBuffer
            ByteBuffer bb = ((NIOBuffer)parser.getHeaderBuffer()).getByteBuffer();
            workerThread.setByteBuffer(bb);
            return super.execute(ctx);
        }       
View Full Code Here

     * Method invoked when the read event is selected for this channel.
     */
    public void onRead(IOEvent<Context> ioEvent) {
        Context ctx = ioEvent.attachment();
        ByteBuffer byteBuffer = null;
        WorkerThread workerThread = (WorkerThread) Thread.currentThread();
        byteBuffer = workerThread.getByteBuffer();
        SelectionKey febeSelectionKey = ctx.getSelectionKey();       
        if (!readFromFeBeChannel(ctx)) {
            return;
       
        /*
 
View Full Code Here

                ctx.setKeyRegistrationState(KeyRegistrationState.CANCEL);

                return false;
            }

            WorkerThread workerThread = (WorkerThread) Thread.currentThread();

            // Re-size the ByteBuffer based on the underlying OS buffer.
            if (workerThread.getByteBuffer().capacity() != bufferSize) {
                if (receiveBufferSizeInBytes <= 0) {
                    try {
                        if (ctx.getProtocol() == Protocol.TCP) {
                            bufferSize = ((SocketChannel) channel).socket().
                                    getReceiveBufferSize();
                        } else {
                            bufferSize = ((DatagramChannel) channel).socket().
                                    getReceiveBufferSize();
                        }
                    } catch (IOException ex) {
                        if (logger.isLoggable(Level.WARNING)) {
                            logger.log(Level.WARNING,
                                    "sip.stack.network.resize_buffer_failed_bad_Socket_state");

                            logger.log(Level.WARNING, ex.getMessage(), ex);
                        }

                        bufferSize = DEFAULT_RECEIVE_BB_SIZE;
                    }
                } else {
                    bufferSize = receiveBufferSizeInBytes;
                }

                if (logger.isLoggable(Level.FINE)) {
                    logger.log(Level.FINE, "sip.stack.network.receivee_buffer",
                            bufferSize);
                }

                workerThread.setByteBuffer(ByteBuffer.allocate(bufferSize));
            }

            boolean invokeNextFilter = super.execute(ctx);

            if (!invokeNextFilter) {
View Full Code Here

            if (!channel.isOpen()) {
                ctx.setKeyRegistrationState(KeyRegistrationState.CANCEL);

                return false;
            }
            WorkerThread workerThread = (WorkerThread) Thread.currentThread();
            if (workerThread.getByteBuffer().capacity() != bufferSize) {
                if (receiveBufferSizeInBytes <= 0) {
                    try {
                        bufferSize = ((SocketChannel) channel).socket().
                                getReceiveBufferSize();
                    } catch (IOException ex) {
                        if (logger.isLoggable(Level.WARNING)) {
                            logger.log(Level.WARNING,
                                    "sip.stack.network.resize_buffer_failed_bad_Socket_state");
                            logger.log(Level.WARNING, ex.getMessage(), ex);
                        }
                        bufferSize = DEFAULT_RECEIVE_BB_SIZE;
                    }
                } else {
                    bufferSize = receiveBufferSizeInBytes;
                }

                if (logger.isLoggable(Level.FINE)) {
                    logger.log(Level.FINE, "sip.stack.network.receivee_buffer",
                            bufferSize);
                }
                workerThread.setByteBuffer(ByteBuffer.allocate(bufferSize));
                inputBBSize = bufferSize;
            }

            boolean continueExecution = super.execute(ctx);
            if (continueExecution) {
View Full Code Here

            SelectionKey key = ioEvent.attachment().getSelectionKey();

            try {
                sslConnectorHandler.finishConnect(key);

                WorkerThread workerThread =
                        (WorkerThread) Thread.currentThread();

                workerThread.setSSLEngine(sslConnectorHandler.getSSLEngine());

                ThreadAttachment attachment =
                        workerThread.updateAttachment(Mode.SSL_ENGINE);

                key.attach(attachment);

                handshakeAppBuffer = acquireBuffer();
                boolean shake =
View Full Code Here

    public TLSResponseDispatcher(SelectorHandler handler, SelectionKey key,
            ByteBufferPool bbPool,
            AsyncWriteCallbackHandler asyncWriteCallbackHandler) {
        super(handler, key, bbPool, asyncWriteCallbackHandler);

        WorkerThread workerThread = ((WorkerThread) Thread.currentThread());

        currentTA = workerThread.getAttachment();
        sslEngine = currentTA.getSSLEngine();
        if (workerThread.getSSLEngine() != null) {
            expectedOutputBufferSize = workerThread.getSSLEngine().getSession().
                    getPacketBufferSize() * 2;
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.grizzly.util.WorkerThread

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.