org.apache.hadoop.hive.ql.txn.compactor.Worker.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(253)

本文整理了Java中org.apache.hadoop.hive.ql.txn.compactor.Worker.<init>()方法的一些代码示例,展示了Worker.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Worker.<init>()方法的具体详情如下:
包路径:org.apache.hadoop.hive.ql.txn.compactor.Worker
类名称:Worker
方法名:<init>

Worker.<init>介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

Worker worker = new Worker();
worker.start();
worker.waitUntilReady(); // <- ADDED
worker.handler.sendMessage(...);

代码示例来源:origin: apache/hive

private void maybeStartCompactorThreads(HiveConf hiveConf) throws Exception {
 if (MetastoreConf.getVar(hiveConf, MetastoreConf.ConfVars.HIVE_METASTORE_RUNWORKER_IN).equals("hs2")) {
  int numWorkers = MetastoreConf.getIntVar(hiveConf, MetastoreConf.ConfVars.COMPACTOR_WORKER_THREADS);
  for (int i = 0; i < numWorkers; i++) {
   Worker w = new Worker();
   CompactorThread.initializeAndStartThread(w, hiveConf);
  }
 }
}

代码示例来源:origin: apache/hive

/**
 * this is a clone from TestHiveStreamingConnection.TxnStatement2....
 */
public static void runWorker(HiveConf hiveConf) throws Exception {
 AtomicBoolean stop = new AtomicBoolean(true);
 Worker t = new Worker();
 t.setThreadId((int) t.getId());
 t.setConf(hiveConf);
 AtomicBoolean looped = new AtomicBoolean();
 t.init(stop, looped);
 t.run();
}

代码示例来源:origin: apache/hive

/**
 * this is a clone from TestTxnStatement2....
 */
public static void runWorker(HiveConf hiveConf) throws Exception {
 AtomicBoolean stop = new AtomicBoolean(true);
 Worker t = new Worker();
 t.setThreadId((int) t.getId());
 t.setConf(hiveConf);
 AtomicBoolean looped = new AtomicBoolean();
 t.init(stop, looped);
 t.run();
}

代码示例来源:origin: apache/hive

private static void runWorker(HiveConf hiveConf) throws MetaException {
 AtomicBoolean stop = new AtomicBoolean(true);
 Worker t = new Worker();
 t.setThreadId((int) t.getId());
 t.setHiveConf(hiveConf);
 AtomicBoolean looped = new AtomicBoolean();
 t.init(stop, looped);
 t.run();
}

代码示例来源:origin: stackoverflow.com

public void runTest() {
  Worker worker = new Worker();
  run(() -> worker.print((field) -> new SomeClass(field)));
  run(() -> worker.print(SomeClass::new));

  Function<Object, Object> func = SomeClass::new;
  run(() -> worker.print(func));

  worker.print(SomeClass::new);
}

代码示例来源:origin: apache/hive

private static void runCompactorThread(HiveConf hiveConf, CompactorThreadType type)
  throws Exception {
 AtomicBoolean stop = new AtomicBoolean(true);
 CompactorThread t = null;
 switch (type) {
  case INITIATOR:
   t = new Initiator();
   break;
  case WORKER:
   t = new Worker();
   break;
  case CLEANER:
   t = new Cleaner();
   break;
  default:
   throw new IllegalArgumentException("Unknown type: " + type);
 }
 t.setThreadId((int) t.getId());
 t.setConf(hiveConf);
 AtomicBoolean looped = new AtomicBoolean();
 t.init(stop, looped);
 t.run();
}

代码示例来源:origin: stackoverflow.com

private void runTest() {
  Worker worker = new Worker();
  run(() -> worker.print(field -> new SomeClass(field)));
  Function<Object, Object> function = SomeClass::new;
  run(() -> worker.print(function));
}

代码示例来源:origin: apache/hive

private void startThread(char type, boolean stopAfterOne, AtomicBoolean looped)
 throws Exception {
 TxnDbUtil.setConfValues(conf);
 CompactorThread t = null;
 switch (type) {
  case 'i': t = new Initiator(); break;
  case 'w': t = new Worker(); break;
  case 'c': t = new Cleaner(); break;
  default: throw new RuntimeException("Huh? Unknown thread type.");
 }
 t.setThreadId((int) t.getId());
 t.setConf(conf);
 stop.set(stopAfterOne);
 t.init(stop, looped);
 if (stopAfterOne) t.run();
 else t.start();
}

代码示例来源:origin: stackoverflow.com

var myWorker = new Worker("DetectWakeup.js");
myWorker.onmessage = function (ev) {
 if (ev && ev.data === 'wakeup') {
   // wakeup here
 }
}

// DetectWakeup.js (put in a separate file)
var lastTime = (new Date()).getTime();
var checkInterval = 10000;

setInterval(function () {
  var currentTime = (new Date()).getTime();

  if (currentTime > (lastTime + checkInterval * 2)) {  // ignore small delays
    postMessage("wakeup");
  }

  lastTime = currentTime;
}, checkInterval);

代码示例来源:origin: stackoverflow.com

private void runTest() {
  Worker worker = new Worker();
  worker.print(field -> new SomeClass(field));
  worker.print(SomeClass::new);
}

代码示例来源:origin: stackoverflow.com

(function() {
  var n, worker, running;

  display("Starting workers...");
  running = 0;
  for (n = 0; n < 5; ++n) {
    workers = new Worker("worker.js");
    workers.onmessage = workerDone;
    workers.postMessage({id: n, count: 10000});
    ++running;
  }
  function workerDone(e) {
    --running;
    display("Worker " + e.data.id + " is done, result: " + e.data.sum);
    if (running === 0) { // <== There is no race condition here, see below
      display("All workers complete");
    }
  }
  function display(msg) {
    var p = document.createElement('p');
    p.innerHTML = String(msg);
    document.body.appendChild(p);
  }
})();

代码示例来源:origin: stackoverflow.com

button.addActionListener(new ActionListener(){
  @Override
  public void actionPerformed(ActionEvent arg0) {
    new Worker().execute();
  }
});

代码示例来源:origin: stackoverflow.com

// in the main script, one starts a worker by passing the file name of the 
// script containing the worker to the constructor. 
var w = new Worker("myworker.js");

// you want to react to the "message" event, if your worker wants to inform
// you of a result. The function typically gets the event as an argument. 
w.addEventListener("message",
  function (evt) {
    // process evt.data, which is the message from the 
    // worker thread
    alert("The answer from the worker is " + evt.data);
  });

代码示例来源:origin: stackoverflow.com

Worker duck = new Worker();
...
Boss boss = (Boss)duck;
...
if (boss instanceof Worker) // check in case you don't know 100% if boss is actually a worker
{
  (Worker)boss.type();
}

代码示例来源:origin: stackoverflow.com

<script>
  var worker = new Worker("worker.js");

  worker.onmessage = function(e) {
    console.log("Send and recieved " + e.data);
  }

  function tellWorker(element) {
    var data = element.value;
    worker.postMessage(data);
  }

</script>

代码示例来源:origin: stackoverflow.com

var myWorker = new Worker("worker.js");
myWorker.postMessage(jsonValue); //jsonValue = your json file

myWorker.onmessage = function(e) {
 var parsedJSON = e.data;
 console.log('Message received from worker', parsedJSON);
}

代码示例来源:origin: stackoverflow.com

ExecutorService es = Executors.newFixedThreadPool(1);
for (int index = 0; index < 10; index++) {
  es.submit(new Worker(index));
}
es.shutdown();

代码示例来源:origin: stackoverflow.com

Worker w1 = new Worker(..list of 500 files...) ; // First List
Worker w2 = new Worker(..list of the other 500 files...) ;  // Second List
Thread t1 = new Thread(w1,"thread1");
Thread t2 = new Thread(w2,"thread2");

t1.start();
t2.start();

代码示例来源:origin: stackoverflow.com

Map<String,Worker> workersMap = new HashMap<>();
workersMap.put ("Денис", new Worker ("Денис", 22626));
...
Worker worker = workersMap.get(a);
if (worker != null) {
  call (worker.getPhone()); // or do whatever you want to do with the phone number
}

相关文章