Search in sources :

Example 11 with Server

use of com.jme3.network.Server in project jmonkeyengine by jMonkeyEngine.

the class SerializerRegistrationsMessage method registerAll.

public void registerAll() {
    // See if we will have problems because our registry is locked        
    if (Serializer.isReadOnly()) {
        // to disable the ServerSerializerRegistrationsServer anyway.
        if (compiled != null) {
            log.log(Level.INFO, "Skipping registration as registry is locked, presumably by a local server process.");
            return;
        }
    }
    log.log(Level.FINE, "Registering {0} classes...", registrations.length);
    for (Registration reg : registrations) {
        log.log(Level.INFO, "Registering:{0}", reg);
        reg.register();
    }
    log.log(Level.FINE, "Done registering serializable classes.");
}
Also used : SerializerRegistration(com.jme3.network.serializing.SerializerRegistration)

Example 12 with Server

use of com.jme3.network.Server in project jmonkeyengine by jMonkeyEngine.

the class RmiHostedService method shareGlobal.

/**
     *  Shares a server-wide object associated with the specified name over the specified
     *  channel.  All connections with RMI hosting started will have access to this shared 
     *  object as soon as they connect and they will all share the same instance.  It is up 
     *  to the shared object to handle any multithreading that might be required.
     *  All network communcation associated with the shared object will be done over
     *  the specified channel. 
     */
public <T> void shareGlobal(byte channel, String name, T object, Class<? super T> type) {
    GlobalShare share = new GlobalShare(channel, object, type);
    GlobalShare existing = globalShares.put(name, share);
    if (existing != null) {
    // Shouldn't need to do anything actually.
    }
    // Go through all of the children
    for (HostedConnection conn : getServer().getConnections()) {
        RmiRegistry child = getRmiRegistry(conn);
        if (child == null) {
            continue;
        }
        child.share(channel, name, object, type);
    }
}
Also used : HostedConnection(com.jme3.network.HostedConnection)

Aggregations

Server (com.jme3.network.Server)3 ClientRegistrationMessage (com.jme3.network.message.ClientRegistrationMessage)3 IOException (java.io.IOException)3 HostedConnection (com.jme3.network.HostedConnection)2 Endpoint (com.jme3.network.kernel.Endpoint)2 SimpleApplication (com.jme3.app.SimpleApplication)1 DefaultClient (com.jme3.network.base.DefaultClient)1 DefaultServer (com.jme3.network.base.DefaultServer)1 TcpConnectorFactory (com.jme3.network.base.TcpConnectorFactory)1 Kernel (com.jme3.network.kernel.Kernel)1 KernelException (com.jme3.network.kernel.KernelException)1 SelectorKernel (com.jme3.network.kernel.tcp.SelectorKernel)1 SocketConnector (com.jme3.network.kernel.tcp.SocketConnector)1 UdpConnector (com.jme3.network.kernel.udp.UdpConnector)1 UdpKernel (com.jme3.network.kernel.udp.UdpKernel)1 ChannelInfoMessage (com.jme3.network.message.ChannelInfoMessage)1 ObjectStore (com.jme3.network.rmi.ObjectStore)1 SerializerRegistration (com.jme3.network.serializing.SerializerRegistration)1 SessionDataDelegator (com.jme3.network.util.SessionDataDelegator)1 InetAddress (java.net.InetAddress)1