本文整理了Java中org.apache.jena.atlas.lib.Lib.sleep()
方法的一些代码示例,展示了Lib.sleep()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lib.sleep()
方法的具体详情如下:
包路径:org.apache.jena.atlas.lib.Lib
类名称:Lib
方法名:sleep
暂无
代码示例来源:origin: apache/jena
@Override
public void run() {
try {
log.info(format("[%d] >> Sleep start", actionId)) ;
Lib.sleep(sleepMilli) ;
log.info(format("[%d] << Sleep finish", actionId)) ;
} catch (Exception ex) {
log.info(format("[%d] **** Exception", actionId), ex) ;
}
}
}
代码示例来源:origin: org.apache.jena/jena-fuseki-core
@Override
public void run() {
try {
log.info(format("[%d] >> Sleep start", actionId)) ;
Lib.sleep(sleepMilli) ;
log.info(format("[%d] << Sleep finish", actionId)) ;
} catch (Exception ex) {
log.info(format("[%d] **** Exception", actionId), ex) ;
}
}
}
代码示例来源:origin: apache/jena
@Override
public NodeValue exec(NodeValue nv)
{
if ( ! nv.isInteger() )
throw new ExprEvalException("Not an integer") ;
int x = nv.getInteger().intValue() ;
Lib.sleep(x) ;
return NodeValue.TRUE ;
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
@Override
public NodeValue exec(NodeValue nv)
{
if ( ! nv.isInteger() )
throw new ExprEvalException("Not an integer") ;
int x = nv.getInteger().intValue() ;
Lib.sleep(x) ;
return NodeValue.TRUE ;
}
}
代码示例来源:origin: apache/jena
@Override
public Boolean call() {
ds.begin(TxnType.READ);
long x = counter.incrementAndGet();
// Hold the lock for a few seconds - these should be in parallel.
Lib.sleep(1000);
ds.commit();
return true;
}
};
代码示例来源:origin: apache/jena
@Override
public Boolean call() {
ds.begin(TxnType.WRITE);
long x = counter.incrementAndGet();
// Hold the lock for a short while.
// The W threads will take the sleep serially.
Lib.sleep(500);
long x1 = counter.get();
assertEquals("Two writers in the transaction", x, x1);
ds.commit();
return true;
}
};
代码示例来源:origin: apache/jena
Lib.sleep(100) ;
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-cmds
public static void main(String... args) {
int PORT = 1357;
String region = "eu-bristol-1";
//// AWSCredentials credentials = new AnonymousAWSCredentials();
//// EndpointConfiguration endpoint = new EndpointConfiguration("http://localhost:"+port, region);
S3Mock api = new S3Mock.Builder().withPort(PORT).withInMemoryBackend().build();
api.start();
System.out.println("MockS3 running");
while(true) {
Lib.sleep(1000);
}
}
}
代码示例来源:origin: apache/jena
@Test
public void alarm_05() {
AlarmClock alarmClock = new AlarmClock() ;
Alarm a = alarmClock.add(callback, 50) ;
alarmClock.reset(a, 20000) ;
sleep(150) ;
// Did not go off.
assertEquals(0, count.get()) ;
alarmClock.cancel(a);
alarmClock.release() ;
}
}
代码示例来源:origin: apache/jena
@Test
public void timeout_01() {
// Test unstable on loaded Jenkins CI on Windows.
String qs = prefix + "SELECT * { ?s ?p ?o }" ;
QueryExecution qExec = QueryExecutionFactory.create(qs, ds) ;
qExec.setTimeout(50, TimeUnit.MILLISECONDS) ;
ResultSet rs = qExec.execSelect() ;
sleep(timeout(100, 300)) ;
exceptionExpected(rs) ;
}
代码示例来源:origin: apache/jena
@Test
public void timeout_21()
{
String qs = prefix + "SELECT * { ?s ?p ?o }" ;
ARQ.getContext().set(ARQ.queryTimeout, "20,10") ;
QueryExecution qExec = QueryExecutionFactory.create(qs, ds) ;
ResultSet rs = qExec.execSelect() ;
sleep(50) ;
exceptionExpected(rs) ;
}
代码示例来源:origin: apache/jena
@Test
public void timeout_04()
{
String qs = prefix + "SELECT * { ?s ?p ?o }" ;
try(QueryExecution qExec = QueryExecutionFactory.create(qs, ds)) {
qExec.setTimeout(50, TimeUnit.MILLISECONDS) ;
ResultSet rs = qExec.execSelect() ;
ResultSetFormatter.consume(rs) ;
sleep(100) ;
rs.hasNext() ; // Query ended - calling rs.hasNext() is safe.
}
}
代码示例来源:origin: apache/jena
@Test
public void timeout_20()
{
String qs = prefix + "SELECT * { ?s ?p ?o }" ;
ARQ.getContext().set(ARQ.queryTimeout, "20") ;
QueryExecution qExec = QueryExecutionFactory.create(qs, ds) ;
ResultSet rs = qExec.execSelect() ;
sleep(50) ;
exceptionExpected(rs) ;
}
代码示例来源:origin: apache/jena
@Test
public void timeout_02()
{
// Test unstable on loaded Jenkins CI on Windows.
String qs = prefix + "SELECT * { ?s ?p ?o }" ;
QueryExecution qExec = QueryExecutionFactory.create(qs, ds) ;
qExec.setTimeout(50, TimeUnit.MILLISECONDS) ;
ResultSet rs = qExec.execSelect() ;
rs.next() ;
sleep(timeout(75, 300)) ;
exceptionExpected(rs) ;
}
代码示例来源:origin: apache/jena
@Test
public void timeout_11()
{
String qs = prefix + "SELECT * { ?s ?p ?o }" ;
try(QueryExecution qExec = QueryExecutionFactory.create(qs, ds)) {
qExec.setTimeout(-1, TimeUnit.MILLISECONDS, 100, TimeUnit.MILLISECONDS) ;
ResultSet rs = qExec.execSelect() ;
rs.next() ; // First timeout does not go off. Resets timer.
rs.next() ; // Second timeout does not go off
sleep(200) ;
exceptionExpected(rs) ;
}
}
代码示例来源:origin: apache/jena
private static void test2(long timeout1, long timeout2, int delay, boolean exceptionExpected)
{
// Enough rows to keep the iterator pipeline full.
try(QueryExecution qExec = QueryExecutionFactory.create(prefix+"SELECT * { ?s ?p ?o }", ds)) {
qExec.setTimeout(timeout1, timeout2) ;
// No rewrite optimizations.
// qExec.getContext().set(ARQConstants.sysOptimizerFactory, Optimize.noOptimizationFactory) ;
ResultSet rs = qExec.execSelect() ;
// ... wait for first binding.
Binding b1 = rs.nextBinding() ;
//System.err.println(b1) ;
// ... then a possible timeout.
sleep(delay) ;
if ( exceptionExpected )
exceptionExpected(rs) ;
else
noException(rs) ;
}
}
}
代码示例来源:origin: apache/jena
@Test
public void timeout_10()
{
String qs = prefix + "SELECT * { ?s ?p ?o }" ;
try(QueryExecution qExec = QueryExecutionFactory.create(qs, ds)) {
qExec.setTimeout(100, TimeUnit.MILLISECONDS, 100, TimeUnit.MILLISECONDS) ;
ResultSet rs = qExec.execSelect() ;
rs.next() ; // First timeout does not go off. Resets timers.
rs.next() ; // Second timeout never goes off
assertTrue(rs.hasNext()) ;
sleep(200) ;
exceptionExpected(rs) ;
}
}
内容来源于网络,如有侵权,请联系作者删除!