You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by si...@apache.org on 2011/01/11 09:46:38 UTC
svn commit: r1057523 -
/incubator/river/jtsk/trunk/src/com/sun/jini/reggie/RegistrarImpl.java
Author: sijskes
Date: Tue Jan 11 08:46:38 2011
New Revision: 1057523
URL: http://svn.apache.org/viewvc?rev=1057523&view=rev
Log:
prepped for new signature
Modified:
incubator/river/jtsk/trunk/src/com/sun/jini/reggie/RegistrarImpl.java
Modified: incubator/river/jtsk/trunk/src/com/sun/jini/reggie/RegistrarImpl.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/trunk/src/com/sun/jini/reggie/RegistrarImpl.java?rev=1057523&r1=1057522&r2=1057523&view=diff
==============================================================================
--- incubator/river/jtsk/trunk/src/com/sun/jini/reggie/RegistrarImpl.java (original)
+++ incubator/river/jtsk/trunk/src/com/sun/jini/reggie/RegistrarImpl.java Tue Jan 11 08:46:38 2011
@@ -389,32 +389,37 @@ class RegistrarImpl implements Registrar
final LifeCycle lifeCycle)
throws Exception
{
- if (activationID != null && !persistent) {
- throw new IllegalArgumentException();
- }
try {
final Configuration config = ConfigurationProvider.getInstance(
configArgs, getClass().getClassLoader());
- loginContext = (LoginContext) config.getEntry(
- COMPONENT, "loginContext", LoginContext.class, null);
- PrivilegedExceptionAction init = new PrivilegedExceptionAction() {
- public Object run() throws Exception {
- init(config, activationID, persistent, lifeCycle);
- return null;
- }
- };
- if (loginContext != null) {
- loginContext.login();
- try {
- Subject.doAsPrivileged(
- loginContext.getSubject(), init, null);
- } catch (PrivilegedActionException e) {
- throw e.getCause();
- }
+ loginAndRun(config,activationID,persistent,lifeCycle);
+ } catch (Throwable t) {
+ logger.log(Level.SEVERE, "Reggie initialization failed", t);
+ if (t instanceof Exception) {
+ throw (Exception) t;
} else {
- init.run();
+ throw (Error) t;
}
+ }
+ }
+
+ /**
+ * Constructs RegistrarImpl based on the
+ * Configuration argument. If activationID is non-null, the created
+ * RegistrarImpl runs as activatable; if persistent is true, it
+ * persists/recovers its state to/from disk. A RegistrarImpl instance
+ * cannot be constructed as both activatable and non-persistent. If
+ * lifeCycle is non-null, its unregister method is invoked during shutdown.
+ */
+ RegistrarImpl(final Configuration config,
+ final ActivationID activationID,
+ final boolean persistent,
+ final LifeCycle lifeCycle)
+ throws Exception
+ {
+ try {
+ loginAndRun(config,activationID,persistent,lifeCycle);
} catch (Throwable t) {
logger.log(Level.SEVERE, "Reggie initialization failed", t);
if (t instanceof Exception) {
@@ -425,6 +430,38 @@ class RegistrarImpl implements Registrar
}
}
+ private void loginAndRun( final Configuration config,
+ final ActivationID activationID,
+ final boolean persistent,
+ final LifeCycle lifeCycle)
+ throws Throwable
+ {
+ if (activationID != null && !persistent) {
+ throw new IllegalArgumentException();
+ }
+
+ loginContext = (LoginContext) config.getEntry(
+ COMPONENT, "loginContext", LoginContext.class, null);
+
+ PrivilegedExceptionAction init = new PrivilegedExceptionAction() {
+ public Object run() throws Exception {
+ init(config, activationID, persistent, lifeCycle);
+ return null;
+ }
+ };
+ if (loginContext != null) {
+ loginContext.login();
+ try {
+ Subject.doAsPrivileged(
+ loginContext.getSubject(), init, null);
+ } catch (PrivilegedActionException e) {
+ throw e.getCause();
+ }
+ } else {
+ init.run();
+ }
+ }
+
/** A service item registration record. */
private final static class SvcReg implements Comparable, Serializable {