Search in sources :

Example 1 with Streamable

use of co.paralleluniverse.common.io.Streamable in project quasar by puniverse.

the class GlxRemoteChannel method send.

private static void send(Object message, GlxGlobalChannelId id) throws SuspendExecution {
    LOG.debug("sent {}", message);
    try {
        if (id.isGlobal()) {
            final long ref = id.getAddress();
            if (message instanceof Streamable) {
                getStore().send(ref, (Streamable) message);
            } else {
                final byte[] buf = Serialization.getInstance().write(message);
                getStore().send(ref, buf);
            }
        } else {
            final short node = (short) id.getAddress();
            if (message instanceof Streamable) {
                getMessenger().send(node, (Long) id.getTopic(), (Streamable) message);
            } else {
                final byte[] buf = Serialization.getInstance().write(message);
                getMessenger().send(node, (Long) id.getTopic(), buf);
            }
        }
    } catch (TimeoutException e) {
        throw new RemoteException(e);
    }
}
Also used : Streamable(co.paralleluniverse.common.io.Streamable) RemoteException(co.paralleluniverse.remote.RemoteException) TimeoutException(co.paralleluniverse.galaxy.TimeoutException)

Aggregations

Streamable (co.paralleluniverse.common.io.Streamable)1 TimeoutException (co.paralleluniverse.galaxy.TimeoutException)1 RemoteException (co.paralleluniverse.remote.RemoteException)1