use of org.apache.derby.shared.common.error.StandardException in project derby by apache.
the class Timeout method buildLockTableString.
/**
* buildLockTableString creates a LockTable info String
*/
private String buildLockTableString() throws StandardException {
sb = new StringBuffer(8192);
outputRow = new char[LENGTHOFTABLE];
// counter
int i;
// need language here to print out tablenames
LanguageConnectionContext lcc = (LanguageConnectionContext) Deadlock.getContext(LanguageConnectionContext.CONTEXT_ID);
if (lcc != null)
tc = lcc.getTransactionExecute();
try {
tabInfo = new TableNameInfo(lcc, true);
} catch (Exception se) {
// just don't do anything
}
sb.append(newline);
sb.append(new Date(currentTime));
sb.append(newline);
for (i = 0; i < column.length; i++) {
sb.append(column[i]);
sb.append(SEPARATOR);
}
sb.append(newline);
for (i = 0; i < LENGTHOFTABLE; i++) sb.append(LINE);
sb.append(newline);
// get the timeout lock info
if (currentLock != null) {
dumpLock();
if (timeoutInfoHash()) {
sb.append("*** The following row is the victim ***");
sb.append(newline);
sb.append(outputRow);
sb.append(newline);
sb.append("*** The above row is the victim ***");
sb.append(newline);
} else {
sb.append("*** A victim was chosen, but it cannot be printed because the lockable object, " + currentLock + ", does not want to participate ***");
sb.append(newline);
}
}
// get lock info from the rest of the table
if (lockTable != null) {
while (lockTable.hasMoreElements()) {
currentLock = (Latch) lockTable.nextElement();
dumpLock();
if (timeoutInfoHash()) {
sb.append(outputRow);
sb.append(newline);
} else {
sb.append("*** A latch/lock, " + currentLock + ", exist in the lockTable that cannot be printed ***");
sb.append(newline);
}
}
for (i = 0; i < LENGTHOFTABLE; i++) sb.append(LINE);
sb.append(newline);
}
return sb.toString();
}
use of org.apache.derby.shared.common.error.StandardException in project derby by apache.
the class BaseMonitor method bootProviderServices.
/**
* Boot all persistent services that can be located by a single service provider
*
* <BR>
* This method enumerates through all the service providers that
* are active and calls bootPersistentServices(PersistentService)
* to boot all the services that that provider knows about.
*/
protected void bootProviderServices(PersistentService provider) {
if (SanityManager.DEBUG && reportOn) {
report("Booting persistent services for provider: " + provider.getType());
}
for (Enumeration e = provider.getBootTimeServices(); (e != null) && e.hasMoreElements(); ) {
String serviceName = (String) e.nextElement();
Properties serviceProperties;
try {
serviceProperties = provider.getServiceProperties(serviceName, null);
} catch (StandardException mse) {
report("Failed to load service properties, name: " + serviceName + ", type = " + provider.getType());
reportException(mse);
continue;
}
// see if this service does not want to be auto-booted.
if (Boolean.valueOf(serviceProperties.getProperty(Property.NO_AUTO_BOOT)).booleanValue())
continue;
try {
startProviderService(provider, serviceName, serviceProperties);
} catch (StandardException mse) {
report("Service failed to boot, name: " + serviceName + ", type = " + provider.getType());
reportException(mse);
continue;
}
}
}
use of org.apache.derby.shared.common.error.StandardException in project derby by apache.
the class BaseMonitor method findProviderAndStartService.
/**
* Find a provider and start a service.
*/
private boolean findProviderAndStartService(String name, Properties properties, boolean bootTime) throws StandardException {
PersistentService actualProvider = null;
Properties serviceProperties = null;
String serviceName = null;
// see if the name already includes a service type
int colon = name.indexOf(':');
if (colon != -1) {
actualProvider = findProviderFromName(name, colon);
// throw an exception
if (actualProvider != null) {
serviceName = actualProvider.getCanonicalServiceName(name);
if (serviceName == null)
// we understand the type, but the service does not exist
return true;
serviceProperties = actualProvider.getServiceProperties(serviceName, properties);
if (serviceProperties == null)
// we understand the type, but the service does not exist
return true;
// see if this service does not want to be auto-booted.
if (bootTime && Boolean.valueOf(serviceProperties.getProperty(Property.NO_AUTO_BOOT)).booleanValue())
return true;
startProviderService(actualProvider, serviceName, serviceProperties);
// we understand the type
return true;
}
}
StandardException savedMse = null;
for (Enumeration e = new ProviderEnumeration(properties); e.hasMoreElements(); ) {
PersistentService provider = (PersistentService) e.nextElement();
String sn = provider.getCanonicalServiceName(name);
if (sn == null)
continue;
Properties p = null;
try {
p = provider.getServiceProperties(sn, properties);
// service does not exist.
if (p == null)
continue;
} catch (StandardException mse) {
savedMse = mse;
}
// yes we can attempt to boot this service
if (actualProvider == null) {
actualProvider = provider;
serviceName = sn;
serviceProperties = p;
continue;
}
// we have an ambigious service name
throw StandardException.newException(SQLState.AMBIGIOUS_PROTOCOL, name);
}
// the monitor claims to always understand these.
if (actualProvider == null)
return colon == -1;
if (savedMse != null)
throw savedMse;
// see if this service does not want to be auto-booted.
if (bootTime && Boolean.valueOf(serviceProperties.getProperty(Property.NO_AUTO_BOOT)).booleanValue())
return true;
startProviderService(actualProvider, serviceName, serviceProperties);
return true;
}
use of org.apache.derby.shared.common.error.StandardException in project derby by apache.
the class AuthenticationServiceBase method getProperty.
/**
* Returns a property if it was set at the database or
* system level. Treated as SERVICE property by default.
*
* @return a property string value.
*/
public String getProperty(String key) {
String propertyValue = null;
TransactionController tc = null;
try {
tc = getTransaction();
propertyValue = PropertyUtil.getServiceProperty(tc, key, (String) null);
if (tc != null) {
tc.commit();
tc = null;
}
} catch (StandardException se) {
// Do nothing and just return
}
return propertyValue;
}
use of org.apache.derby.shared.common.error.StandardException in project derby by apache.
the class AuthenticationServiceBase method getDatabaseProperty.
public String getDatabaseProperty(String key) {
String propertyValue = null;
TransactionController tc = null;
try {
if (store != null)
tc = store.getTransaction(getContextService().getCurrentContextManager());
propertyValue = PropertyUtil.getDatabaseProperty(tc, key);
if (tc != null) {
tc.commit();
tc = null;
}
} catch (StandardException se) {
// Do nothing and just return
}
return propertyValue;
}
Aggregations