//
// ========================================================================
-// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
+// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
if (_dbAdaptor == null)
throw new IllegalStateException ("No DBAdaptor");
String longType = _dbAdaptor.getLongType();
- return "alter table "+getTableName()+" add "+getMaxIntervalColumn()+" "+longType+" not null default "+MAX_INTERVAL_NOT_SET;
+ String stem = "alter table "+getTableName()+" add "+getMaxIntervalColumn()+" "+longType;
+ if (_dbAdaptor.getDBName().contains("oracle"))
+ return stem + " default "+ MAX_INTERVAL_NOT_SET + " not null";
+ else
+ return stem +" not null default "+ MAX_INTERVAL_NOT_SET;
}
private void checkNotNull(String s)
throws SQLException
{
_dbName = dbMeta.getDatabaseProductName().toLowerCase(Locale.ENGLISH);
- LOG.debug ("Using database {}",_dbName);
+ if (LOG.isDebugEnabled())
+ LOG.debug ("Using database {}",_dbName);
_isLower = dbMeta.storesLowerCaseIdentifiers();
_isUpper = dbMeta.storesUpperCaseIdentifiers();
}
finally
{
if (_scheduler != null && _scheduler.isRunning())
- _scheduler.schedule(this, _scavengeIntervalMs, TimeUnit.MILLISECONDS);
+ _task = _scheduler.schedule(this, _scavengeIntervalMs, TimeUnit.MILLISECONDS);
}
}
}
if (LOG.isDebugEnabled())
LOG.debug("Scavenging every "+_scavengeIntervalMs+" ms");
- //if (_timer!=null && (period!=old_period || _task==null))
- if (_scheduler != null && (period!=old_period || _task==null))
+ synchronized (this)
{
- synchronized (this)
+ //if (_timer!=null && (period!=old_period || _task==null))
+ if (_scheduler != null && (period!=old_period || _task==null))
{
if (_task!=null)
_task.cancel();
_ownScheduler = true;
_scheduler.start();
}
+ else if (!_scheduler.isStarted())
+ throw new IllegalStateException("Shared scheduler not started");
setScavengeInterval(getScavengeInterval());
}