Package groovyx.gpars.remote

Examples of groovyx.gpars.remote.RemoteHost


        this.connection = connection;
    }

    @Override
    protected void encode(ChannelHandlerContext ctx, Serializable msg, ByteBuf out) throws Exception {
        final RemoteHost remoteHost = connection.getHost();

        if (remoteHost != null) {
            remoteHost.enter();
        }
        try {
            super.encode(ctx, msg, out);
        }
        catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
        finally {
            if (remoteHost != null) {
                remoteHost.leave();
            }
        }
    }
View Full Code Here


        this.connection = connection;
    }

    @Override
    protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
        final RemoteHost remoteHost = connection.getHost();

        if (remoteHost != null) {
            remoteHost.enter();
        }
        try {
            return super.decode(ctx, in);
        }
        finally {
            if (remoteHost != null) {
                remoteHost.leave();
            }
        }
    }
View Full Code Here

                this.serialId = serialId;
            }

            @Override
            public void execute(final RemoteConnection conn) {
                final RemoteHost remoteHost = conn.getHost();
                final SerialHandle handle = remoteHost.get(serialId);
                if (handle instanceof LocalSerialHandle) {
                    handle.unsubscribe(remoteHost);
                }
            }
View Full Code Here

                @Override
                @SuppressWarnings("unchecked")
                public void run() {
                    final Object sub = serialHandle.getSubscribers();
                    if (sub instanceof RemoteHost) {
                        final RemoteHost host = (RemoteHost) sub;
                        if (hostId == null || !host.getHostId().equals(hostId)) {
                            host.write(new BindDataflow(DataflowExpression.this, value, host.getLocalHost().getId()));
                        }
                    }
                    if (sub instanceof List) {
                        //noinspection SynchronizeOnNonFinalField
                        synchronized (serialHandle) {
                            for (final SerialContext host : (List<SerialContext>) sub) {
                                if (hostId == null || !host.getHostId().equals(hostId)) {
                                    host.write(new BindDataflow(DataflowExpression.this, value, host.getLocalHostId()));
                                }
                            }
                        }
                    }
                }
View Full Code Here

    private void notifyRemote(T value) {
        if (serialHandle != null) {
            // TODO schedule this job?
            final Object sub = serialHandle.getSubscribers();
            if (sub instanceof RemoteHost) {
                RemoteHost remoteHost = (RemoteHost)sub;
                remoteHost.write(new BindDataflowStream(this, value));
            }
            if (sub instanceof List) {
                List<RemoteHost> subs = (List<RemoteHost>) sub;
                for (RemoteHost subscriber : subs) {
                    subscriber.write(new BindDataflowStream<T>(this, value));
View Full Code Here

TOP

Related Classes of groovyx.gpars.remote.RemoteHost

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.