@Override public final void configure(ServiceProfile<?> profile) throws InterruptedException, IOException { try { configureScope(profile); doConfigure(profile); } catch (IllegalArgumentException e) { throw new IOException( MessageFormat.format( "Failed to configure \"{0}\" ({1})", profile.getPrefix(), profile.getPrefix()), e); } }
private void configureScope(ServiceProfile<?> profile) throws IOException { assert profile != null; String scopeSymbol = profile.getConfiguration(KEY_SCOPE, false, true); if (scopeSymbol == null) { scope = ExecutionLock.Scope.getDefault(); LOG.debug("Lock scope is not defined, use default: {}", scope.getSymbol()); } else { scope = ExecutionLock.Scope.findFromSymbol(scopeSymbol); if (scope == null) { throw new IOException( MessageFormat.format( "Unknown lock scope in \"{0}.{1}\": {2}", profile.getPrefix(), KEY_SCOPE, scopeSymbol)); } } }