public void broadcast( Filter<? super Endpoint> filter, ByteBuffer data, boolean reliable, boolean copy ) { kernel.broadcast( filter, data, reliable, copy ); }
public void initialize() { kernel.initialize(); }
protected void flushEvents() { EndpointEvent event; while( (event = kernel.nextEvent()) != null ) { try { createAndDispatch( event ); } catch( Exception e ) { reportError(event.getEndpoint(), event, e); } } }
public void close() throws InterruptedException { go.set(false); // Kill the kernel kernel.terminate(); join(); }
public void run() { while( go.get() ) { try { // Check for pending events flushEvents(); // Grab the next envelope Envelope e = kernel.read(); if( e == Kernel.EVENTS_PENDING ) continue; // We'll catch it up above // Check for pending events that might have // come in while we were blocking. This is usually // when the connection add events come through flushEvents(); try { createAndDispatch( e ); } catch( Exception ex ) { reportError(e.getSource(), e, ex); } } catch( InterruptedException ex ) { if( !go.get() ) return; throw new RuntimeException( "Unexpected interruption", ex ); } } }
public void close() throws InterruptedException { go.set(false); // Kill the kernel kernel.terminate(); }
public void run() { while( go.get() ) { try { // Check for pending events flushEvents(); // Grab the next envelope Envelope e = kernel.read(); if( e == Kernel.EVENTS_PENDING ) continue; // We'll catch it up above // Check for pending events that might have // come in while we were blocking. This is usually // when the connection add events come through flushEvents(); try { createAndDispatch( e ); } catch( Exception ex ) { reportError(e.getSource(), e, ex); } } catch( InterruptedException ex ) { if( !go.get() ) return; throw new RuntimeException( "Unexpected interruption", ex ); } } }
public void close() throws InterruptedException { go.set(false); // Kill the kernel kernel.terminate(); join(); }
protected void flushEvents() { EndpointEvent event; while( (event = kernel.nextEvent()) != null ) { try { createAndDispatch( event ); } catch( Exception e ) { reportError(event.getEndpoint(), event, e); } } }
public void initialize() { kernel.initialize(); }
public void broadcast( Filter<? super Endpoint> filter, ByteBuffer data, boolean reliable, boolean copy ) { kernel.broadcast( filter, data, reliable, copy ); }
public void run() { while( go.get() ) { try { // Check for pending events flushEvents(); // Grab the next envelope Envelope e = kernel.read(); if( e == Kernel.EVENTS_PENDING ) continue; // We'll catch it up above // Check for pending events that might have // come in while we were blocking. This is usually // when the connection add events come through flushEvents(); try { createAndDispatch( e ); } catch( Exception ex ) { reportError(e.getSource(), e, ex); } } catch( InterruptedException ex ) { if( !go.get() ) return; throw new RuntimeException( "Unexpected interruption", ex ); } } }
protected void flushEvents() { EndpointEvent event; while( (event = kernel.nextEvent()) != null ) { try { createAndDispatch( event ); } catch( Exception e ) { reportError(event.getEndpoint(), event, e); } } }
public void start() { if( isRunning ) throw new IllegalStateException( "Server is already started." ); // Initialize the kernels reliable.initialize(); if( fast != null ) { fast.initialize(); } // Start em up reliableAdapter.start(); if( fastAdapter != null ) { fastAdapter.start(); } isRunning = true; }
public void broadcast( Filter<? super HostedConnection> filter, Message message ) { ByteBuffer buffer = MessageProtocol.messageToBuffer(message, null); FilterAdapter adapter = filter == null ? null : new FilterAdapter(filter); // Ignore the filter for the moment if( message.isReliable() || fast == null ) { // Don't need to copy the data because message protocol is already // giving us a fresh buffer reliable.broadcast( adapter, buffer, true, false ); } else { fast.broadcast( adapter, buffer, false, false ); } }