Package org.gradle.messaging.remote.internal

Examples of org.gradle.messaging.remote.internal.MessagingServices


    ClassLoaderFactory createClassLoaderFactory() {
        return new DefaultClassLoaderFactory();
    }

    MessagingServices createMessagingServices(ClassLoaderRegistry classLoaderRegistry) {
        return new MessagingServices(getClass().getClassLoader());
    }
View Full Code Here


        this.displayName = displayName;
        this.serverAddress = serverAddress;
    }

    public void execute(final WorkerContext workerContext) {
        MessagingServices messagingServices = createClient();
        try {
            final MessagingClient client = messagingServices.get(MessagingClient.class);
            final ObjectConnection clientConnection = client.getConnection(serverAddress);
            try {
                LOGGER.debug("Starting {}.", displayName);
                WorkerProcessContext context = new WorkerProcessContext() {
                    public ObjectConnection getServerConnection() {
                        return clientConnection;
                    }

                    public ClassLoader getApplicationClassLoader() {
                        return workerContext.getApplicationClassLoader();
                    }

                    public Object getWorkerId() {
                        return workerId;
                    }

                    public String getDisplayName() {
                        return displayName;
                    }
                };

                ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
                Thread.currentThread().setContextClassLoader(action.getClass().getClassLoader());
                try {
                    action.execute(context);
                } finally {
                    Thread.currentThread().setContextClassLoader(contextClassLoader);
                }
                LOGGER.debug("Completed {}.", displayName);
            } finally {
                clientConnection.stop();
            }
        } finally {
            LOGGER.debug("Stopping client connection.");
            messagingServices.stop();
        }
    }
View Full Code Here

            messagingServices.stop();
        }
    }

    MessagingServices createClient() {
        return new MessagingServices(getClass().getClassLoader());
    }
View Full Code Here

TOP

Related Classes of org.gradle.messaging.remote.internal.MessagingServices

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.