Merge branch 'master' into PBRisComing
This commit is contained in:
commit
e5608d6e38
@ -737,8 +737,8 @@ public class PhysicsRigidBody extends PhysicsCollisionObject {
|
||||
setKinematic(capsule.readBoolean("kinematic", false));
|
||||
|
||||
setRestitution(capsule.readFloat("restitution", 0));
|
||||
Vector3f angularFactor = (Vector3f) capsule.readSavable("angularFactor", Vector3f.NAN.clone());
|
||||
if(angularFactor == Vector3f.NAN) {
|
||||
Vector3f angularFactor = (Vector3f) capsule.readSavable("angularFactor", null);
|
||||
if(angularFactor == null) {
|
||||
setAngularFactor(capsule.readFloat("angularFactor", 1));
|
||||
} else {
|
||||
setAngularFactor(angularFactor);
|
||||
|
@ -746,27 +746,43 @@ public class RenderManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the light filter to use when rendering Lighted Geometries
|
||||
* Sets the light filter to use when rendering lighted Geometries
|
||||
*
|
||||
* @see LightFilter
|
||||
* @param lightFilter The light filter tose. Set it to null if you want all lights to be rendered
|
||||
* @param lightFilter The light filter. Set it to null if you want all lights to be rendered
|
||||
*/
|
||||
public void setLightFilter(LightFilter lightFilter) {
|
||||
this.lightFilter = lightFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines what light mode will be selected when a technique offers several light modes
|
||||
* @param preferredLightMode
|
||||
*/
|
||||
public void setPreferredLightMode(TechniqueDef.LightMode preferredLightMode) {
|
||||
this.preferredLightMode = preferredLightMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the preferred light mode
|
||||
* @return the light mode
|
||||
*/
|
||||
public TechniqueDef.LightMode getPreferredLightMode() {
|
||||
return preferredLightMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the number of lights used for each pass when the light mode is single pass.
|
||||
* @return the number of lights.
|
||||
*/
|
||||
public int getSinglePassLightBatchSize() {
|
||||
return singlePassLightBatchSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of lights to use for each pass when the light mode is single pass.
|
||||
* @param singlePassLightBatchSize the number of lights
|
||||
*/
|
||||
public void setSinglePassLightBatchSize(int singlePassLightBatchSize) {
|
||||
this.singlePassLightBatchSize = singlePassLightBatchSize;
|
||||
}
|
||||
|
@ -67,18 +67,18 @@ public class DefaultClient implements Client
|
||||
private static final int CH_UNRELIABLE = 1;
|
||||
private static final int CH_FIRST = 2;
|
||||
|
||||
private ThreadLocal<ByteBuffer> dataBuffer = new ThreadLocal<ByteBuffer>();
|
||||
private final ThreadLocal<ByteBuffer> dataBuffer = new ThreadLocal<ByteBuffer>();
|
||||
|
||||
private int id = -1;
|
||||
private boolean isRunning = false;
|
||||
private CountDownLatch connecting = new CountDownLatch(1);
|
||||
private final CountDownLatch connecting = new CountDownLatch(1);
|
||||
private String gameName;
|
||||
private int version;
|
||||
private MessageListenerRegistry<Client> messageListeners = new MessageListenerRegistry<Client>();
|
||||
private List<ClientStateListener> stateListeners = new CopyOnWriteArrayList<ClientStateListener>();
|
||||
private List<ErrorListener<? super Client>> errorListeners = new CopyOnWriteArrayList<ErrorListener<? super Client>>();
|
||||
private Redispatch dispatcher = new Redispatch();
|
||||
private List<ConnectorAdapter> channels = new ArrayList<ConnectorAdapter>();
|
||||
private final MessageListenerRegistry<Client> messageListeners = new MessageListenerRegistry<Client>();
|
||||
private final List<ClientStateListener> stateListeners = new CopyOnWriteArrayList<ClientStateListener>();
|
||||
private final List<ErrorListener<? super Client>> errorListeners = new CopyOnWriteArrayList<ErrorListener<? super Client>>();
|
||||
private final Redispatch dispatcher = new Redispatch();
|
||||
private final List<ConnectorAdapter> channels = new ArrayList<ConnectorAdapter>();
|
||||
|
||||
private ConnectorFactory connectorFactory;
|
||||
|
||||
@ -100,6 +100,7 @@ public class DefaultClient implements Client
|
||||
}
|
||||
|
||||
protected void addStandardServices() {
|
||||
log.fine("Adding standard services...");
|
||||
services.addService(new ClientSerializerRegistrationsService());
|
||||
}
|
||||
|
||||
@ -128,6 +129,7 @@ public class DefaultClient implements Client
|
||||
throw new IllegalStateException( "Client is not started." );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
if( isRunning )
|
||||
@ -179,6 +181,7 @@ public class DefaultClient implements Client
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStarted() {
|
||||
return isRunning;
|
||||
}
|
||||
@ -195,33 +198,42 @@ public class DefaultClient implements Client
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnected()
|
||||
{
|
||||
return id != -1 && isRunning;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGameName()
|
||||
{
|
||||
return gameName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientServiceManager getServices()
|
||||
{
|
||||
return services;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send( Message message )
|
||||
{
|
||||
if( log.isLoggable(Level.FINER) ) {
|
||||
log.log(Level.FINER, "send({0})", message);
|
||||
}
|
||||
if( message.isReliable() || channels.get(CH_UNRELIABLE) == null ) {
|
||||
send(CH_RELIABLE, message, true);
|
||||
} else {
|
||||
@ -229,8 +241,12 @@ public class DefaultClient implements Client
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send( int channel, Message message )
|
||||
{
|
||||
if( log.isLoggable(Level.FINER) ) {
|
||||
log.log(Level.FINER, "send({0}, {1})", new Object[]{channel, message});
|
||||
}
|
||||
if( channel >= 0 ) {
|
||||
// Make sure we aren't still connecting. Channels
|
||||
// won't be valid until we are fully connected since
|
||||
@ -275,6 +291,7 @@ public class DefaultClient implements Client
|
||||
channels.get(channel).write(buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
checkRunning();
|
||||
@ -287,9 +304,11 @@ public class DefaultClient implements Client
|
||||
if( !isRunning )
|
||||
return;
|
||||
|
||||
// Let the services get a chance to stop before we
|
||||
// kill the connection.
|
||||
services.stop();
|
||||
if( services.isStarted() ) {
|
||||
// Let the services get a chance to stop before we
|
||||
// kill the connection.
|
||||
services.stop();
|
||||
}
|
||||
|
||||
// Send a close message
|
||||
|
||||
@ -313,41 +332,49 @@ public class DefaultClient implements Client
|
||||
services.terminate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addClientStateListener( ClientStateListener listener )
|
||||
{
|
||||
stateListeners.add( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeClientStateListener( ClientStateListener listener )
|
||||
{
|
||||
stateListeners.remove( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMessageListener( MessageListener<? super Client> listener )
|
||||
{
|
||||
messageListeners.addMessageListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMessageListener( MessageListener<? super Client> listener, Class... classes )
|
||||
{
|
||||
messageListeners.addMessageListener( listener, classes );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMessageListener( MessageListener<? super Client> listener )
|
||||
{
|
||||
messageListeners.removeMessageListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMessageListener( MessageListener<? super Client> listener, Class... classes )
|
||||
{
|
||||
messageListeners.removeMessageListener( listener, classes );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addErrorListener( ErrorListener<? super Client> listener )
|
||||
{
|
||||
errorListeners.add( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeErrorListener( ErrorListener<? super Client> listener )
|
||||
{
|
||||
errorListeners.remove( listener );
|
||||
@ -461,11 +488,13 @@ public class DefaultClient implements Client
|
||||
|
||||
protected class Redispatch implements MessageListener<Object>, ErrorListener<Object>
|
||||
{
|
||||
@Override
|
||||
public void messageReceived( Object source, Message m )
|
||||
{
|
||||
dispatch( m );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleError( Object source, Throwable t )
|
||||
{
|
||||
// Only doing the DefaultClient.this to make the code
|
||||
|
@ -66,26 +66,26 @@ public class DefaultServer implements Server
|
||||
private static final int CH_FIRST = 2;
|
||||
|
||||
private boolean isRunning = false;
|
||||
private AtomicInteger nextId = new AtomicInteger(0);
|
||||
private final AtomicInteger nextId = new AtomicInteger(0);
|
||||
private String gameName;
|
||||
private int version;
|
||||
private KernelFactory kernelFactory = KernelFactory.DEFAULT;
|
||||
private final KernelFactory kernelFactory = KernelFactory.DEFAULT;
|
||||
private KernelAdapter reliableAdapter;
|
||||
private KernelAdapter fastAdapter;
|
||||
private List<KernelAdapter> channels = new ArrayList<KernelAdapter>();
|
||||
private List<Integer> alternatePorts = new ArrayList<Integer>();
|
||||
private Redispatch dispatcher = new Redispatch();
|
||||
private Map<Integer,HostedConnection> connections = new ConcurrentHashMap<Integer,HostedConnection>();
|
||||
private Map<Endpoint,HostedConnection> endpointConnections
|
||||
private final List<KernelAdapter> channels = new ArrayList<KernelAdapter>();
|
||||
private final List<Integer> alternatePorts = new ArrayList<Integer>();
|
||||
private final Redispatch dispatcher = new Redispatch();
|
||||
private final Map<Integer,HostedConnection> connections = new ConcurrentHashMap<Integer,HostedConnection>();
|
||||
private final Map<Endpoint,HostedConnection> endpointConnections
|
||||
= new ConcurrentHashMap<Endpoint,HostedConnection>();
|
||||
|
||||
// Keeps track of clients for whom we've only received the UDP
|
||||
// registration message
|
||||
private Map<Long,Connection> connecting = new ConcurrentHashMap<Long,Connection>();
|
||||
private final Map<Long,Connection> connecting = new ConcurrentHashMap<Long,Connection>();
|
||||
|
||||
private MessageListenerRegistry<HostedConnection> messageListeners
|
||||
private final MessageListenerRegistry<HostedConnection> messageListeners
|
||||
= new MessageListenerRegistry<HostedConnection>();
|
||||
private List<ConnectionListener> connectionListeners = new CopyOnWriteArrayList<ConnectionListener>();
|
||||
private final List<ConnectionListener> connectionListeners = new CopyOnWriteArrayList<ConnectionListener>();
|
||||
|
||||
private HostedServiceManager services;
|
||||
|
||||
@ -108,24 +108,29 @@ public class DefaultServer implements Server
|
||||
}
|
||||
|
||||
protected void addStandardServices() {
|
||||
log.fine("Adding standard services...");
|
||||
services.addService(new ServerSerializerRegistrationsService());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGameName()
|
||||
{
|
||||
return gameName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostedServiceManager getServices()
|
||||
{
|
||||
return services;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addChannel( int port )
|
||||
{
|
||||
if( isRunning )
|
||||
@ -164,6 +169,7 @@ public class DefaultServer implements Server
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
if( isRunning )
|
||||
@ -185,11 +191,13 @@ public class DefaultServer implements Server
|
||||
services.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunning()
|
||||
{
|
||||
return isRunning;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
if( !isRunning )
|
||||
@ -214,13 +222,19 @@ public class DefaultServer implements Server
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void broadcast( Message message )
|
||||
{
|
||||
broadcast( null, message );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void broadcast( Filter<? super HostedConnection> filter, Message message )
|
||||
{
|
||||
if( log.isLoggable(Level.FINER) ) {
|
||||
log.log(Level.FINER, "broadcast({0}, {1})", new Object[]{filter, message});
|
||||
}
|
||||
|
||||
if( connections.isEmpty() )
|
||||
return;
|
||||
|
||||
@ -237,8 +251,13 @@ public class DefaultServer implements Server
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void broadcast( int channel, Filter<? super HostedConnection> filter, Message message )
|
||||
{
|
||||
if( log.isLoggable(Level.FINER) ) {
|
||||
log.log(Level.FINER, "broadcast({0}, {1}. {2})", new Object[]{channel, filter, message});
|
||||
}
|
||||
|
||||
if( connections.isEmpty() )
|
||||
return;
|
||||
|
||||
@ -251,46 +270,55 @@ public class DefaultServer implements Server
|
||||
channels.get(channel+CH_FIRST).broadcast( adapter, buffer, true, false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostedConnection getConnection( int id )
|
||||
{
|
||||
return connections.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConnections()
|
||||
{
|
||||
return !connections.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<HostedConnection> getConnections()
|
||||
{
|
||||
return Collections.unmodifiableCollection((Collection<HostedConnection>)connections.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConnectionListener( ConnectionListener listener )
|
||||
{
|
||||
connectionListeners.add(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeConnectionListener( ConnectionListener listener )
|
||||
{
|
||||
connectionListeners.remove(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMessageListener( MessageListener<? super HostedConnection> listener )
|
||||
{
|
||||
messageListeners.addMessageListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMessageListener( MessageListener<? super HostedConnection> listener, Class... classes )
|
||||
{
|
||||
messageListeners.addMessageListener( listener, classes );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMessageListener( MessageListener<? super HostedConnection> listener )
|
||||
{
|
||||
messageListeners.removeMessageListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMessageListener( MessageListener<? super HostedConnection> listener, Class... classes )
|
||||
{
|
||||
messageListeners.removeMessageListener( listener, classes );
|
||||
@ -484,12 +512,12 @@ public class DefaultServer implements Server
|
||||
|
||||
protected class Connection implements HostedConnection
|
||||
{
|
||||
private int id;
|
||||
private final int id;
|
||||
private boolean closed;
|
||||
private Endpoint[] channels;
|
||||
private int setChannelCount = 0;
|
||||
|
||||
private Map<String,Object> sessionData = new ConcurrentHashMap<String,Object>();
|
||||
private final Map<String,Object> sessionData = new ConcurrentHashMap<String,Object>();
|
||||
|
||||
public Connection( int channelCount )
|
||||
{
|
||||
@ -523,23 +551,30 @@ public class DefaultServer implements Server
|
||||
return setChannelCount == channels.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Server getServer()
|
||||
{
|
||||
return DefaultServer.this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAddress()
|
||||
{
|
||||
return channels[CH_RELIABLE] == null ? null : channels[CH_RELIABLE].getAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send( Message message )
|
||||
{
|
||||
if( log.isLoggable(Level.FINER) ) {
|
||||
log.log(Level.FINER, "send({0})", message);
|
||||
}
|
||||
ByteBuffer buffer = MessageProtocol.messageToBuffer(message, null);
|
||||
if( message.isReliable() || channels[CH_UNRELIABLE] == null ) {
|
||||
channels[CH_RELIABLE].send( buffer );
|
||||
@ -548,8 +583,12 @@ public class DefaultServer implements Server
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send( int channel, Message message )
|
||||
{
|
||||
if( log.isLoggable(Level.FINER) ) {
|
||||
log.log(Level.FINER, "send({0}, {1})", new Object[]{channel, message});
|
||||
}
|
||||
checkChannel(channel);
|
||||
ByteBuffer buffer = MessageProtocol.messageToBuffer(message, null);
|
||||
channels[channel+CH_FIRST].send(buffer);
|
||||
@ -573,6 +612,7 @@ public class DefaultServer implements Server
|
||||
fireConnectionRemoved( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close( String reason )
|
||||
{
|
||||
// Send a reason
|
||||
@ -593,6 +633,7 @@ public class DefaultServer implements Server
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object setAttribute( String name, Object value )
|
||||
{
|
||||
if( value == null )
|
||||
@ -601,11 +642,13 @@ public class DefaultServer implements Server
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T getAttribute( String name )
|
||||
{
|
||||
return (T)sessionData.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> attributeNames()
|
||||
{
|
||||
return Collections.unmodifiableSet(sessionData.keySet());
|
||||
@ -621,6 +664,7 @@ public class DefaultServer implements Server
|
||||
|
||||
protected class Redispatch implements MessageListener<HostedConnection>
|
||||
{
|
||||
@Override
|
||||
public void messageReceived( HostedConnection source, Message m )
|
||||
{
|
||||
dispatch( source, m );
|
||||
@ -629,13 +673,14 @@ public class DefaultServer implements Server
|
||||
|
||||
protected class FilterAdapter implements Filter<Endpoint>
|
||||
{
|
||||
private Filter<? super HostedConnection> delegate;
|
||||
private final Filter<? super HostedConnection> delegate;
|
||||
|
||||
public FilterAdapter( Filter<? super HostedConnection> delegate )
|
||||
{
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply( Endpoint input )
|
||||
{
|
||||
HostedConnection conn = getConnection( input );
|
||||
|
@ -53,7 +53,7 @@ import java.util.LinkedList;
|
||||
*/
|
||||
public class MessageProtocol
|
||||
{
|
||||
private LinkedList<Message> messages = new LinkedList<Message>();
|
||||
private final LinkedList<Message> messages = new LinkedList<Message>();
|
||||
private ByteBuffer current;
|
||||
private int size;
|
||||
private Byte carry;
|
||||
|
@ -45,6 +45,7 @@ import java.nio.ByteBuffer;
|
||||
import java.util.*;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogManager;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -403,6 +404,10 @@ public abstract class Serializer {
|
||||
if (reg == null) {
|
||||
throw new SerializerException( "Class not registered:" + type );
|
||||
}
|
||||
|
||||
if( log.isLoggable(Level.FINER) ) {
|
||||
log.log(Level.FINER, "writing class:{0} with ID:{1}", new Object[]{type, reg.getId()});
|
||||
}
|
||||
buffer.putShort(reg.getId());
|
||||
return reg;
|
||||
}
|
||||
|
@ -106,6 +106,6 @@ public abstract class AbstractService<S extends ServiceManager> implements Servi
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + "[serviceManager.class=" + serviceManager.getClass() + "]";
|
||||
return getClass().getName() + "[serviceManager.class=" + (serviceManager != null ? serviceManager.getClass() : "") + "]";
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,8 @@ package com.jme3.network.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* The base service manager class from which the HostedServiceManager
|
||||
@ -44,7 +46,9 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
*/
|
||||
public abstract class ServiceManager<T> {
|
||||
|
||||
private List<Service<T>> services = new CopyOnWriteArrayList<Service<T>>();
|
||||
static final Logger log = Logger.getLogger(ServiceManager.class.getName());
|
||||
|
||||
private final List<Service<T>> services = new CopyOnWriteArrayList<Service<T>>();
|
||||
private volatile boolean started = false;
|
||||
|
||||
protected ServiceManager() {
|
||||
@ -76,6 +80,9 @@ public abstract class ServiceManager<T> {
|
||||
return;
|
||||
}
|
||||
for( Service<T> s : services ) {
|
||||
if( log.isLoggable(Level.FINE) ) {
|
||||
log.log(Level.FINE, "Starting service:{0}", s);
|
||||
}
|
||||
s.start();
|
||||
}
|
||||
started = true;
|
||||
@ -96,6 +103,9 @@ public abstract class ServiceManager<T> {
|
||||
throw new IllegalStateException(getClass().getSimpleName() + " not started.");
|
||||
}
|
||||
for( Service<T> s : services ) {
|
||||
if( log.isLoggable(Level.FINE) ) {
|
||||
log.log(Level.FINE, "Stopping service:{0}", s);
|
||||
}
|
||||
s.stop();
|
||||
}
|
||||
started = false;
|
||||
@ -106,9 +116,18 @@ public abstract class ServiceManager<T> {
|
||||
* has already been started then the service will also be started.
|
||||
*/
|
||||
public <S extends Service<T>> void addService( S s ) {
|
||||
if( log.isLoggable(Level.FINE) ) {
|
||||
log.log(Level.FINE, "addService({0})", s);
|
||||
}
|
||||
services.add(s);
|
||||
if( log.isLoggable(Level.FINE) ) {
|
||||
log.log(Level.FINE, "Initializing service:{0}", s);
|
||||
}
|
||||
s.initialize(getParent());
|
||||
if( started ) {
|
||||
if( log.isLoggable(Level.FINE) ) {
|
||||
log.log(Level.FINE, "Starting service:{0}", s);
|
||||
}
|
||||
s.start();
|
||||
}
|
||||
}
|
||||
@ -120,10 +139,19 @@ public abstract class ServiceManager<T> {
|
||||
* the service will be terminated.
|
||||
*/
|
||||
public <S extends Service<T>> void removeService( S s ) {
|
||||
if( log.isLoggable(Level.FINE) ) {
|
||||
log.log(Level.FINE, "removeService({0})", s);
|
||||
}
|
||||
if( started ) {
|
||||
if( log.isLoggable(Level.FINE) ) {
|
||||
log.log(Level.FINE, "Stopping service:{0}", s);
|
||||
}
|
||||
s.stop();
|
||||
}
|
||||
services.remove(s);
|
||||
if( log.isLoggable(Level.FINE) ) {
|
||||
log.log(Level.FINE, "Terminating service:{0}", s);
|
||||
}
|
||||
s.terminate(getParent());
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user