final variables and parameters

This commit is contained in:
thatsIch
2015-09-30 14:24:40 +02:00
parent 059523f543
commit 8b3a954f73
732 changed files with 9253 additions and 9256 deletions
+22 -22
View File
@@ -39,7 +39,7 @@ public class NetworkEventBus
private static final Collection<Class> READ_CLASSES = new HashSet<Class>();
private static final Map<Class<? extends MENetworkEvent>, Map<Class, MENetworkEventInfo>> EVENTS = new HashMap<Class<? extends MENetworkEvent>, Map<Class, MENetworkEventInfo>>();
public void readClass( Class listAs, Class c )
public void readClass( final Class listAs, final Class c )
{
if( READ_CLASSES.contains( c ) )
{
@@ -49,12 +49,12 @@ public class NetworkEventBus
try
{
for( Method m : c.getMethods() )
for( final Method m : c.getMethods() )
{
MENetworkEventSubscribe s = m.getAnnotation( MENetworkEventSubscribe.class );
final MENetworkEventSubscribe s = m.getAnnotation( MENetworkEventSubscribe.class );
if( s != null )
{
Class[] types = m.getParameterTypes();
final Class[] types = m.getParameterTypes();
if( types.length == 1 )
{
if( MENetworkEvent.class.isAssignableFrom( types[0] ) )
@@ -88,32 +88,32 @@ public class NetworkEventBus
}
}
}
catch( Throwable t )
catch( final Throwable t )
{
throw new IllegalStateException( "Error while adding " + c.getName() + " to event bus", t );
}
}
public MENetworkEvent postEvent( Grid g, MENetworkEvent e )
public MENetworkEvent postEvent( final Grid g, final MENetworkEvent e )
{
Map<Class, MENetworkEventInfo> subscribers = EVENTS.get( e.getClass() );
final Map<Class, MENetworkEventInfo> subscribers = EVENTS.get( e.getClass() );
int x = 0;
try
{
if( subscribers != null )
{
for( Entry<Class, MENetworkEventInfo> subscriber : subscribers.entrySet() )
for( final Entry<Class, MENetworkEventInfo> subscriber : subscribers.entrySet() )
{
MENetworkEventInfo target = subscriber.getValue();
GridCacheWrapper cache = g.getCaches().get( subscriber.getKey() );
final MENetworkEventInfo target = subscriber.getValue();
final GridCacheWrapper cache = g.getCaches().get( subscriber.getKey() );
if( cache != null )
{
x++;
target.invoke( cache.myCache, e );
}
for( IGridNode obj : g.getMachines( subscriber.getKey() ) )
for( final IGridNode obj : g.getMachines( subscriber.getKey() ) )
{
x++;
target.invoke( obj.getMachine(), e );
@@ -121,7 +121,7 @@ public class NetworkEventBus
}
}
}
catch( NetworkEventDone done )
catch( final NetworkEventDone done )
{
// Early out.
}
@@ -130,16 +130,16 @@ public class NetworkEventBus
return e;
}
public MENetworkEvent postEventTo( Grid grid, GridNode node, MENetworkEvent e )
public MENetworkEvent postEventTo( final Grid grid, final GridNode node, final MENetworkEvent e )
{
Map<Class, MENetworkEventInfo> subscribers = EVENTS.get( e.getClass() );
final Map<Class, MENetworkEventInfo> subscribers = EVENTS.get( e.getClass() );
int x = 0;
try
{
if( subscribers != null )
{
MENetworkEventInfo target = subscribers.get( node.getMachineClass() );
final MENetworkEventInfo target = subscribers.get( node.getMachineClass() );
if( target != null )
{
x++;
@@ -147,7 +147,7 @@ public class NetworkEventBus
}
}
}
catch( NetworkEventDone done )
catch( final NetworkEventDone done )
{
// Early out.
}
@@ -170,20 +170,20 @@ public class NetworkEventBus
public final Method objMethod;
public final Class objEvent;
public EventMethod( Class Event, Class ObjClass, Method ObjMethod )
public EventMethod( final Class Event, final Class ObjClass, final Method ObjMethod )
{
this.objClass = ObjClass;
this.objMethod = ObjMethod;
this.objEvent = Event;
}
public void invoke( Object obj, MENetworkEvent e ) throws NetworkEventDone
public void invoke( final Object obj, final MENetworkEvent e ) throws NetworkEventDone
{
try
{
this.objMethod.invoke( obj, e );
}
catch( Throwable e1 )
catch( final Throwable e1 )
{
AELog.severe( "[AppEng] Network Event caused exception:" );
AELog.severe( "Offending Class: " + obj.getClass().getName() );
@@ -205,14 +205,14 @@ public class NetworkEventBus
private final List<EventMethod> methods = new ArrayList<EventMethod>();
public void Add( Class Event, Class ObjClass, Method ObjMethod )
public void Add( final Class Event, final Class ObjClass, final Method ObjMethod )
{
this.methods.add( new EventMethod( Event, ObjClass, ObjMethod ) );
}
public void invoke( Object obj, MENetworkEvent e ) throws NetworkEventDone
public void invoke( final Object obj, final MENetworkEvent e ) throws NetworkEventDone
{
for( EventMethod em : this.methods )
for( final EventMethod em : this.methods )
{
em.invoke( obj, e );
}