users@grizzly.java.net

Re: Problem with SSL

From: quende <skrinnikov_at_gmail.com>
Date: Mon, 29 Sep 2008 23:57:08 -0700 (PDT)

Hello, thank you for reply

>Are you spawning you own thread? In Grizzly, we have "special" Thread
>that have some attribute. From you code snipped it is hard to diagnose,
>but I suspect the caller thread is not an instance of WorkerThread.
>Could it be the issue? Make sure when you creates a Thread you create it
>using:

>https://grizzly.dev.java.net/nonav/apidocs/com/sun/grizzly/util/WorkerThreadFactory.html
>https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/util/WorkerThreadFactory.html


>Thanks

>-- Jeanfrancois

Actually, I do the following:
when starting the server i create a default pipeline

ControllerUtils.startController(_controller);
_pipeline = new DefaultPipeline();
_pipeline.setMinThreads(20);
_pipeline.setMaxThreads(30);
_pipeline.initPipeline();
_pipeline.startPipeline();

Also, i have a function, to throw my callable object into this pipeline
public void addDispatchTask(Callable callable)
    {
        try
        {
            _pipeline.execute(callable);
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

Where the callable class has a structure similar to:

public class Client implements Callable
{
    private SelectionKey clientSelectionKey;
    private ConcurrentLinkedQueue<Message> _messages = new
ConcurrentLinkedQueue<Message>();

    public Client(SelectionKey key)
    {
        clientSelectionKey = key;
    }

    @Override
    public Object call()
    {
        try
        {
            for(Message message : _messages)
            {
                if (clientSelectionKey.isValid())
                {
                     
SSLOutputWriter.flushChannel(clientSelectionKey.channel(),
message.getByteBuffer());
                }
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        return true;
    }

//functions to add messages to list, etc.
//...
}

Where Message - is a class, containing some string i want to send to client
and a function, to get ByteBuffer from it. In TCP case, I may simply write
into SocketChannel, that I get with given SelectionKey and it works fine,
but with SSL i get the exception mentioned in previous post.
So, should use WorkerThreadFactory somewhere, or the issue is in something
else?

Thank you,
-- Quende
-- 
View this message in context: http://www.nabble.com/Problem-with-SSL-tp19709902p19737086.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.