本文整理匯總了Java中java.util.concurrent.TimeoutException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java TimeoutException.printStackTrace方法的具體用法?Java TimeoutException.printStackTrace怎麽用?Java TimeoutException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.concurrent.TimeoutException
的用法示例。
在下文中一共展示了TimeoutException.printStackTrace方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: validate
import java.util.concurrent.TimeoutException; //導入方法依賴的package包/類
@Test
public void validate() {
try {
testProcess();
} catch (TimeoutException e) {
e.printStackTrace();
}
//Run Validation to make sure things happened correctly
serviceNow.searchFor(this.IncNumber);
if(serviceNow.getFieldValueByLabel("Number").equalsIgnoreCase(this.IncNumber)) {
assertTrue("The Incident ["+this.IncNumber+"] was created successfully",true);
}
else {
fail("The Incident ["+this.IncNumber+"] was NOT created successfully");
}
}
示例2: validate
import java.util.concurrent.TimeoutException; //導入方法依賴的package包/類
@Test
public void validate() {
try {
testProcess();
} catch (TimeoutException e) {
e.printStackTrace();
}
//Run Validation to make sure things happened correctly
serviceNow.searchFor(this.IncNumber);
if(serviceNow.getFieldValueByLabel("Short description").equalsIgnoreCase("Moved incident to In Progress") &&
serviceNow.getFieldValueByLabel("State").equalsIgnoreCase("In Progress")) {
assertTrue("The Incident ["+this.IncNumber+"] was updated successfully",true);
}
else {
fail("The Incident ["+this.IncNumber+"] was NOT updated successfully");
}
}
示例3: validate
import java.util.concurrent.TimeoutException; //導入方法依賴的package包/類
@Test
public void validate() {
try {
testProcess();
} catch (TimeoutException e) {
e.printStackTrace();
}
//Run Validation to make sure things happened correctly
serviceNow.searchFor(this.IncNumber);
if(serviceNow.getFieldValueByLabel("Short description").equalsIgnoreCase("Moved incident to Closed") &&
serviceNow.getFieldValueByLabel("State").equalsIgnoreCase("Closed") &&
serviceNow.getFieldValueByLabel("Close code").equalsIgnoreCase("Solved (Work Around)") &&
serviceNow.getFieldValueByLabel("Close notes").equalsIgnoreCase("This is a test incident that is now being closed.")) {
assertTrue("The Incident ["+this.IncNumber+"] was updated successfully",true);
}
else {
fail("The Incident ["+this.IncNumber+"] was NOT updated successfully");
}
}
示例4: validate
import java.util.concurrent.TimeoutException; //導入方法依賴的package包/類
/**
* This is an example of checking that a InfoMessage is given containing a specific substring.
*/
@Test
public void validate() {
try {
testProcess();
} catch (TimeoutException e) {
e.printStackTrace();
}
//Run Validation to make sure things happened correctly
if(serviceNow.getInfoMessageContaining(this.IncNumber+" was created.") != null) {
assertTrue("The Incident ["+this.IncNumber+"] was created successfully",true);
}
else {
fail("The Incident ["+this.IncNumber+"] was NOT created successfully");
}
}
示例5: test
import java.util.concurrent.TimeoutException; //導入方法依賴的package包/類
/**
* An Example of creating a problem and validating it has been created.
*/
@Test
public void test() {
try {
testProcess();
} catch (TimeoutException e) {
e.printStackTrace();
}
//Run Validation to make sure things happened correctly
serviceNow.searchFor(this.PrbNumber);
if(serviceNow.getFieldValueByLabel("Number").equalsIgnoreCase(this.PrbNumber)) {
assertTrue("The Incident ["+this.PrbNumber+"] was created successfully",true);
}
else {
fail("The Incident ["+this.PrbNumber+"] was NOT created successfully");
}
}
示例6: test
import java.util.concurrent.TimeoutException; //導入方法依賴的package包/類
/**
* An Example of creating a problem and validating it has been created.
*/
@Test
public void test() {
try {
testProcess();
} catch (TimeoutException e) {
e.printStackTrace();
}
//Run Validation to make sure things happened correctly
// serviceNow.searchFor(this.ChangeNumber);
// if(serviceNow.getFieldValueByLabel("Number").equalsIgnoreCase(this.ChangeNumber)) {
// assertTrue("The Change ["+this.ChangeNumber+"] was created successfully",true);
// }
// else {
fail("The Change ["+this.ChangeNumber+"] was NOT created successfully");
// }
}
示例7: validate
import java.util.concurrent.TimeoutException; //導入方法依賴的package包/類
@Test
public void validate() {
try {
testProcess();
} catch (TimeoutException e) {
e.printStackTrace();
}
//Run Validation to make sure things happened correctly
//Check if PRB Exists
boolean prbExists = false;
boolean IncLinkedtoPrb = false;
serviceNow.searchFor(this.PrbNumber);
if(serviceNow.getFieldValueByLabel("Number").equalsIgnoreCase(this.PrbNumber)) {
prbExists = true;
}
//Check if INC is linked to PRB from PRB form
serviceNow.searchFor(this.IncNumber);
serviceNow.clickTabByLabel("Related Records");
if(serviceNow.getFieldValueByLabel("Problem").equalsIgnoreCase(this.PrbNumber)) {
IncLinkedtoPrb = true;
}
if (prbExists && IncLinkedtoPrb) {
assertTrue("The Problem ["+this.PrbNumber+"] was created successfully from ["+this.IncNumber+"].",true);
}
else {
fail("A Problem was not created successfully from ["+this.IncNumber+"].");
}
}
示例8: validate
import java.util.concurrent.TimeoutException; //導入方法依賴的package包/類
@Test
public void validate() {
try {
testProcess();
} catch (TimeoutException e) {
e.printStackTrace();
}
//Run Validation to make sure things happened correctly
boolean infoMessageCorrect = false;
boolean changeTypeIsCorrect = false;
boolean changeOnIncidentForm = false;
if (serviceNow.getInfoMessageContaining("Change "+this.ChangeNumber+" created") != null) {
infoMessageCorrect = true;
}
if(serviceNow.getFieldValueByLabel("Type").equalsIgnoreCase("Emergency")) {
changeTypeIsCorrect = true;
}
serviceNow.searchFor(this.IncNumber);
serviceNow.clickTabByLabel("Related Records");
if (serviceNow.getFieldValueByLabel("Change Request").equalsIgnoreCase(this.ChangeNumber)) {
changeOnIncidentForm = true;
}
if(infoMessageCorrect && changeTypeIsCorrect && changeOnIncidentForm) {
assertTrue("The Change ["+this.ChangeNumber+"] was created successfully",true);
}
else {
fail("The Change ["+this.ChangeNumber+"] was NOT created successfully");
}
}
示例9: validate
import java.util.concurrent.TimeoutException; //導入方法依賴的package包/類
@Test
public void validate() {
try {
testProcess();
} catch (TimeoutException e) {
e.printStackTrace();
}
//Run Validation to make sure things happened correctly
boolean infoMessageCorrect = false;
boolean changeTypeIsCorrect = false;
boolean changeOnIncidentForm = false;
if (serviceNow.getInfoMessageContaining("Change "+this.ChangeNumber+" created") != null) {
infoMessageCorrect = true;
}
if(serviceNow.getFieldValueByLabel("Type").equalsIgnoreCase("Normal")) {
changeTypeIsCorrect = true;
}
serviceNow.searchFor(this.IncNumber);
serviceNow.clickTabByLabel("Related Records");
if (serviceNow.getFieldValueByLabel("Change Request").equalsIgnoreCase(this.ChangeNumber)) {
changeOnIncidentForm = true;
}
if(infoMessageCorrect && changeTypeIsCorrect && changeOnIncidentForm) {
assertTrue("The Change ["+this.ChangeNumber+"] was created successfully",true);
}
else {
fail("The Change ["+this.ChangeNumber+"] was NOT created successfully");
}
}
示例10: shutdown
import java.util.concurrent.TimeoutException; //導入方法依賴的package包/類
/**
* Ask rmid to shutdown gracefully using a remote method call.
* catch any errors that might occur from rmid not being present
* at time of shutdown invocation. If the remote call is
* successful, wait for the process to terminate. Return true
* if the process terminated, otherwise return false.
*/
private boolean shutdown() throws InterruptedException {
mesg("shutdown()");
long startTime = System.currentTimeMillis();
ActivationSystem system = lookupSystem(port);
if (system == null) {
mesg("lookupSystem() returned null after " +
(System.currentTimeMillis() - startTime) + "ms.");
return false;
}
try {
mesg("ActivationSystem.shutdown()");
system.shutdown();
} catch (Exception e) {
mesg("Caught exception from ActivationSystem.shutdown():");
e.printStackTrace();
}
try {
waitFor(TIMEOUT_SHUTDOWN_MS);
mesg("Shutdown successful after " +
(System.currentTimeMillis() - startTime) + "ms.");
return true;
} catch (TimeoutException ex) {
mesg("Shutdown timed out after " +
(System.currentTimeMillis() - startTime) + "ms:");
ex.printStackTrace();
return false;
}
}
示例11: destroy
import java.util.concurrent.TimeoutException; //導入方法依賴的package包/類
/**
* Ask rmid to shutdown gracefully but then destroy the rmid
* process if it does not exit by itself. This method only works
* if rmid is a child process of the current VM.
*/
public void destroy() {
if (vm == null) {
throw new IllegalStateException("can't wait for RMID that isn't running");
}
long startTime = System.currentTimeMillis();
// First, attempt graceful shutdown of the activation system.
try {
if (! shutdown()) {
// Graceful shutdown failed, use Process.destroy().
mesg("Destroying RMID process.");
vm.destroy();
try {
waitFor(TIMEOUT_DESTROY_MS);
mesg("Destroy successful after " +
(System.currentTimeMillis() - startTime) + "ms.");
} catch (TimeoutException ex) {
mesg("Destroy timed out, giving up after " +
(System.currentTimeMillis() - startTime) + "ms:");
ex.printStackTrace();
}
}
} catch (InterruptedException ie) {
mesg("Shutdown/destroy interrupted, giving up at " +
(System.currentTimeMillis() - startTime) + "ms.");
ie.printStackTrace();
Thread.currentThread().interrupt();
return;
}
vm = null;
}
示例12: run
import java.util.concurrent.TimeoutException; //導入方法依賴的package包/類
/**
* Entry point.
* All recent finished azkaban jobs' lineage. Will write to database stagging table
* @param timeFrame in minutes
* @param endTimeStamp in millisecond
* @throws Exception
*/
public void run(int timeFrame, long endTimeStamp)
throws Exception {
// get recent finished job
AzJobChecker azJobChecker = new AzJobChecker(prop);
List<AzkabanJobExecRecord> jobExecList = azJobChecker.getRecentFinishedJobFromFlow(timeFrame, endTimeStamp);
azJobChecker.close();
logger.info("Total number of azkaban jobs : {}", jobExecList.size());
ActorSystem actorSystem = ActorSystem.create("LineageExtractor");
int numOfActor = Integer.valueOf(prop.getProperty(Constant.LINEAGE_ACTOR_NUM, "50"));
ActorRef lineageExtractorActor = actorSystem
.actorOf(new SmallestMailboxPool(numOfActor).props(Props.create(AzLineageExtractorActor.class)),
"lineageExtractorActor");
// initialize
//AzkabanServiceCommunicator asc = new AzkabanServiceCommunicator(prop);
HadoopJobHistoryNodeExtractor hnne = new HadoopJobHistoryNodeExtractor(prop);
AzDbCommunicator adc = new AzDbCommunicator(prop);
String wherehowsUrl = prop.getProperty(Constant.WH_DB_URL_KEY);
String wherehowsUserName = prop.getProperty(Constant.WH_DB_USERNAME_KEY);
String wherehowsPassWord = prop.getProperty(Constant.WH_DB_PASSWORD_KEY);
String connUrl = wherehowsUrl + "?" + "user=" + wherehowsUserName + "&password=" + wherehowsPassWord;
Connection conn = DriverManager.getConnection(connUrl);
DatabaseWriter databaseWriter = new DatabaseWriter(connUrl, "stg_job_execution_data_lineage");
AzLogParser.initialize(conn);
PathAnalyzer.initialize(conn);
int timeout = 30; // default 30 minutes for one job
if (prop.containsKey(Constant.LINEAGE_ACTOR_TIMEOUT_KEY))
timeout = Integer.valueOf(prop.getProperty(Constant.LINEAGE_ACTOR_TIMEOUT_KEY));
List<Future<Object>> result = new ArrayList<>();
for (AzkabanJobExecRecord aje : jobExecList) {
AzExecMessage message = new AzExecMessage(aje, prop);
message.asc = null;
message.hnne = hnne;
message.adc = adc;
message.databaseWriter = databaseWriter;
message.connection = conn;
Timeout t = new Timeout(timeout, TimeUnit.SECONDS);
Future<Object> fut = Patterns.ask(lineageExtractorActor, message, t);
result.add(fut);
}
// join all threads
Future<Iterable<Object>> seq = Futures.sequence(result, actorSystem.dispatcher());
try {
Await.result(seq, Duration.create(timeout + " seconds"));
} catch (TimeoutException exception) {
exception.printStackTrace();
}
adc.close();
hnne.close();
databaseWriter.close();
logger.info("All job finished lineage collecting!");
}
示例13: run
import java.util.concurrent.TimeoutException; //導入方法依賴的package包/類
/**
* Entry point.
* All recent finished azkaban jobs' lineage. Will write to database stagging table
* @param timeFrame in minutes
* @param endTimeStamp in millisecond
* @throws Exception
*/
public void run(int timeFrame, long endTimeStamp) throws Exception {
// get recent finished job
LzJobChecker lzJobChecker = new LzJobChecker(prop);
List<LzTaskExecRecord> taskExecList = lzJobChecker.getRecentFinishedJobFromFlow(timeFrame, endTimeStamp);
lzJobChecker.close();
logger.info("Total number of lhotse jobs : {}", taskExecList.size());
ActorSystem actorSystem = ActorSystem.create("LhotseLineageExtractor");
int numOfActor = Integer.valueOf(prop.getProperty(Constant.LZ_LINEAGE_ACTOR_NUM, "50"));
ActorRef lineageExtractorActor = actorSystem
.actorOf(new SmallestMailboxPool(numOfActor).props(Props.create(LzLineageExtractorActor.class)),
"lhotseLineageExtractorActor");
String wherehowsUrl = prop.getProperty(Constant.WH_DB_URL_KEY);
String wherehowsUserName = prop.getProperty(Constant.WH_DB_USERNAME_KEY);
String wherehowsPassWord = prop.getProperty(Constant.WH_DB_PASSWORD_KEY);
String connUrl = wherehowsUrl + "?" + "user=" + wherehowsUserName + "&password=" + wherehowsPassWord;
Connection conn = DriverManager.getConnection(connUrl);
DatabaseWriter databaseWriter = new DatabaseWriter(connUrl, "stg_job_execution_data_lineage");
PathAnalyzer.initialize(conn);
int timeout = 30; // default 30 minutes for one job
if (prop.containsKey(Constant.LZ_LINEAGE_ACTOR_TIMEOUT_KEY))
timeout = Integer.valueOf(prop.getProperty(Constant.LZ_LINEAGE_ACTOR_TIMEOUT_KEY));
List<Future<Object>> result = new ArrayList<>();
for (LzTaskExecRecord lzRecord: taskExecList) {
LzExecMessage lzExecMessage = new LzExecMessage(lzRecord, prop);
lzExecMessage.connection = conn;
lzExecMessage.databaseWriter = databaseWriter;
Timeout t = new Timeout(timeout, TimeUnit.SECONDS);
Future<Object> fut = Patterns.ask(lineageExtractorActor, lzExecMessage, t);
result.add(fut);
}
// join all threads
Future<Iterable<Object>> seq = Futures.sequence(result, actorSystem.dispatcher());
try {
Await.result(seq, Duration.create(timeout + " seconds"));
} catch (TimeoutException exception) {
exception.printStackTrace();
}
databaseWriter.close();
logger.info("All job finished lineage collecting!");
}