use of org.apache.manifoldcf.core.interfaces.ManifoldCFException in project manifoldcf by apache.
the class CmisRepositoryConnector method checkConnection.
protected void checkConnection() throws ManifoldCFException, ServiceInterruption {
while (true) {
boolean noSession = (session == null);
getSession();
long currentTime;
CheckConnectionThread t = new CheckConnectionThread();
try {
t.start();
t.join();
Throwable thr = t.getException();
if (thr != null) {
if (thr instanceof RemoteException)
throw (RemoteException) thr;
else if (thr instanceof CmisConnectionException)
throw new ManifoldCFException("CMIS: Error during checking connection: " + thr.getMessage(), thr);
else
throw (Error) thr;
}
return;
} catch (InterruptedException e) {
t.interrupt();
throw new ManifoldCFException("Interrupted: " + e.getMessage(), e, ManifoldCFException.INTERRUPTED);
} catch (RemoteException e) {
Throwable e2 = e.getCause();
if (e2 instanceof InterruptedException || e2 instanceof InterruptedIOException)
throw new ManifoldCFException(e2.getMessage(), e2, ManifoldCFException.INTERRUPTED);
if (noSession) {
currentTime = System.currentTimeMillis();
throw new ServiceInterruption("Transient error connecting to filenet service: " + e.getMessage(), currentTime + 60000L);
}
session = null;
lastSessionFetch = -1L;
continue;
}
}
}
use of org.apache.manifoldcf.core.interfaces.ManifoldCFException in project manifoldcf by apache.
the class CmisRepositoryConnector method releaseCheck.
/**
* Release the session, if it's time.
*/
protected void releaseCheck() throws ManifoldCFException {
if (lastSessionFetch == -1L)
return;
long currentTime = System.currentTimeMillis();
if (currentTime >= lastSessionFetch + timeToRelease) {
DestroySessionThread t = new DestroySessionThread();
try {
t.start();
t.join();
Throwable thr = t.getException();
if (thr != null) {
if (thr instanceof RemoteException)
throw (RemoteException) thr;
else
throw (Error) thr;
}
session = null;
lastSessionFetch = -1L;
} catch (InterruptedException e) {
t.interrupt();
throw new ManifoldCFException("Interrupted: " + e.getMessage(), e, ManifoldCFException.INTERRUPTED);
} catch (RemoteException e) {
Throwable e2 = e.getCause();
if (e2 instanceof InterruptedException || e2 instanceof InterruptedIOException)
throw new ManifoldCFException(e2.getMessage(), e2, ManifoldCFException.INTERRUPTED);
session = null;
lastSessionFetch = -1L;
// Treat this as a transient problem
Logging.connectors.warn("CMIS: Transient remote exception closing session: " + e.getMessage(), e);
}
}
}
use of org.apache.manifoldcf.core.interfaces.ManifoldCFException in project manifoldcf by apache.
the class APISanityHSQLDBIT method waitJobInactive.
protected void waitJobInactive(String jobIDString, long maxTime) throws Exception {
long startTime = System.currentTimeMillis();
while (System.currentTimeMillis() < startTime + maxTime) {
String status = getJobStatus(jobIDString);
if (status == null)
throw new Exception("No such job: '" + jobIDString + "'");
if (status.equals("not yet run"))
throw new Exception("Job was never started.");
if (status.equals("done"))
return;
if (status.equals("error"))
throw new Exception("Job reports error.");
ManifoldCF.sleep(1000L);
continue;
}
throw new ManifoldCFException("ManifoldCF did not terminate in the allotted time of " + new Long(maxTime).toString() + " milliseconds");
}
use of org.apache.manifoldcf.core.interfaces.ManifoldCFException in project manifoldcf by apache.
the class AmazonS3Connector method check.
/**
*/
@Override
public String check() throws ManifoldCFException {
// connect with amazons3 client
Logging.connectors.info("Checking connection");
try {
// invokes the check thread
CheckThread checkThread = new CheckThread(getClient());
checkThread.start();
// should wait for join
checkThread.join();
if (checkThread.getException() != null) {
Throwable thr = checkThread.getException();
return "Check exception: " + thr.getMessage();
}
return checkThread.getResult();
} catch (InterruptedException ex) {
Logging.connectors.error("Error while checking connection", ex);
throw new ManifoldCFException(ex.getMessage(), ex, ManifoldCFException.INTERRUPTED);
}
}
use of org.apache.manifoldcf.core.interfaces.ManifoldCFException in project manifoldcf by apache.
the class AmazonS3Connector method getSeeds.
private void getSeeds(ISeedingActivity activities, String[] buckets) throws ManifoldCFException, ServiceInterruption {
GetSeedsThread t = new GetSeedsThread(getClient(), buckets);
try {
t.start();
boolean wasInterrupted = false;
try {
XThreadBuffer<S3Artifact> seedBuffer = t.getBuffer();
// join with the child thread.
while (true) {
// The only kind of exceptions this can throw are going to
// shut the process down.
S3Artifact s3Artifact = seedBuffer.fetch();
if (s3Artifact == null) {
Logging.connectors.info("No artifact retured");
break;
}
String issueKey = s3Artifact.getBucketName() + STD_SEPARATOR_BUCKET_AND_KEY + s3Artifact.getKey();
Logging.connectors.info("Issue key is : " + issueKey);
activities.addSeedDocument(issueKey);
}
} catch (InterruptedException e) {
Logging.connectors.error(e);
wasInterrupted = true;
throw e;
} catch (ManifoldCFException e) {
Logging.connectors.error(e);
if (e.getErrorCode() == ManifoldCFException.INTERRUPTED)
wasInterrupted = true;
throw e;
} finally {
if (!wasInterrupted)
t.finishUp();
}
} catch (InterruptedException e) {
Logging.connectors.error(e);
t.interrupt();
throw new ManifoldCFException("Interrupted: " + e.getMessage(), e, ManifoldCFException.INTERRUPTED);
} catch (java.net.SocketTimeoutException e) {
Logging.connectors.error(e);
handleIOException(e);
} catch (InterruptedIOException e) {
Logging.connectors.error(e);
t.interrupt();
handleIOException(e);
} catch (IOException e) {
Logging.connectors.error(e);
handleIOException(e);
} catch (ResponseException e) {
Logging.connectors.error(e);
handleResponseException(e);
}
}
Aggregations