diff options
author | Simon Rettberg | 2015-08-17 22:11:56 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-08-17 22:11:56 +0200 |
commit | 5d2bb10d260681082443354a42f5db119a381dba (patch) | |
tree | 5ecfb90b210053804ce91b9ee26cb7457166bb39 /src/main/java/org/openslx/thrifthelper/ThriftManager.java | |
parent | Thrift api changes (diff) | |
download | master-sync-shared-5d2bb10d260681082443354a42f5db119a381dba.tar.gz master-sync-shared-5d2bb10d260681082443354a42f5db119a381dba.tar.xz master-sync-shared-5d2bb10d260681082443354a42f5db119a381dba.zip |
Separate error callbacks for master and sat
Diffstat (limited to 'src/main/java/org/openslx/thrifthelper/ThriftManager.java')
-rw-r--r-- | src/main/java/org/openslx/thrifthelper/ThriftManager.java | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/main/java/org/openslx/thrifthelper/ThriftManager.java b/src/main/java/org/openslx/thrifthelper/ThriftManager.java index b132a9e..56b99b3 100644 --- a/src/main/java/org/openslx/thrifthelper/ThriftManager.java +++ b/src/main/java/org/openslx/thrifthelper/ThriftManager.java @@ -32,7 +32,9 @@ public class ThriftManager public boolean thriftError( int failCount, String method, Throwable t ); } - private static ErrorCallback errorCallback = null; + private static ErrorCallback masterErrorCallback = null; + + private static ErrorCallback satelliteErrorCallback = null; /** * Private members for master connection information @@ -70,7 +72,7 @@ public class ThriftManager @Override public boolean error( int failCount, String method, Throwable t ) { - return errorCallback != null && errorCallback.thriftError( failCount, method, t ); + return satelliteErrorCallback != null && satelliteErrorCallback.thriftError( failCount, method, t ); } } ) ); @@ -113,7 +115,7 @@ public class ThriftManager public boolean error( int failCount, String method, Throwable t ) { synchronized ( LOGGER ) { - return errorCallback != null && errorCallback.thriftError( failCount, method, t ); + return masterErrorCallback != null && masterErrorCallback.thriftError( failCount, method, t ); } } } ) ); @@ -182,14 +184,27 @@ public class ThriftManager /** * Set the callback class for errors that occur on one of the - * thrift connections. + * thrift connections to the master server. * * @param cb */ - public static void setErrorCallback( ErrorCallback cb ) + public static void setMasterErrorCallback( ErrorCallback cb ) { synchronized ( LOGGER ) { - errorCallback = cb; + masterErrorCallback = cb; + } + } + + /** + * Set the callback class for errors that occur on one of the + * thrift connections to the satellite server. + * + * @param cb + */ + public static void setSatelliteErrorCallback( ErrorCallback cb ) + { + synchronized ( LOGGER ) { + satelliteErrorCallback = cb; } } |