static ServiceRefAmp current() { return (ServiceRefAmp) ServiceRef.current(); }
@OnActive public void onStart() { _serviceRef = ServiceRef.current(); }
@OnActive public void onStart() { _serviceRef = ServiceRef.current(); }
@OnActive public void onStart() { _serviceRef = ServiceRef.current(); }
@OnInit private void onInit() { _self = ServiceRef.current(); }
@Override public void addModifiedChild(StubAmp actor) { Objects.requireNonNull(actor); _modifiedList.add(actor); if (_isActive && _modifiedList.size() > SAVE_MAX && _isSaveRequested.compareAndSet(false, true)) { ServiceRef serviceRef = ServiceRef.current(); serviceRef.save(Result.ignore()); } }
@Override public void onActive() { _isActive = true; ArrayList<StubAmp> children = new ArrayList<>(_modifiedList); //_modifiedList.clear(); ServiceRefAmp serviceRef = (ServiceRefAmp) ServiceRef.current(); for (StubAmp stub : children) { stub.state().onActive(stub, serviceRef.inbox()); } }
@Override public BfsFileSync lookup(String path) { if (path == null || path.equals("")) { return null; } String name = path.substring(1); TableKraken table = _tableManager.getTable(name); if (table == null) { return null; } ProcKrakenDebugTable debugTable = new ProcKrakenDebugTable(name); ServiceRef serviceRef = ServiceRef.current(); return serviceRef.pin(debugTable) .as(FileServiceBind.class); }
public void test(Result<String> result) { result.ok("Hello " + ServiceRef.current()); } }
@OnInit public void onStart() { _serviceRef = ServiceRef.current(); ServicesAmp manager = AmpSystem.currentManager(); EventsSync events = manager.service(EventsSync.class); // XXX: events.subscriber(ServerOnUpdate.class, s->onServerUpdate(s)); // XXX: events.subscriber(PodOnUpdate.class, p->onPodUpdate(p)); }
public void test(Result<String> result) { result.ok("Hello " + ServiceRef.current()); } }
@OnInit private void onStart() { _lifecycle.toActive(); _timerSelf = ServiceRef.current().as(TimerServiceAmp.class); }
public void test(Result<String> result) { result.ok("Hello " + ServiceRef.current()); } }
void set(int pid, X page) { int chunkIndex = pid / _chunkSize; int chunkOffset = pid % _chunkSize; while (_chunks.length <= chunkIndex) { extend(); } AtomicReferenceArray<X> chunk = _chunks[chunkIndex]; X oldPage = chunk.get(chunkOffset); if (oldPage != null && page.getSequence() < oldPage.getSequence()) { System.err.println("Invalid page set:" + " old:" + oldPage + " new:" + page + " " + ServiceRef.current()); if (log.isLoggable(Level.FINE)) { Thread.dumpStack(); } } chunk.set(chunkOffset, page); }
@OnInit public void onInit(Result<Void> result) { _self = ServiceRef.current().service(_id).as(RabbitPipeImpl.class); try { _config = RabbitConfig.from(_c, _id); if (_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "onInit: " + _id + ", " + _config); } connect(); result.ok(null); } catch (Exception e) { _logger.log(Level.WARNING, "onInit: cannot connect, " + _id + ", " + _config, e); result.fail(e); } }
+ " old:" + oldPage + " new:" + newPage + " (" + oldPage.getSequence() + "," + newPage.getSequence() + ") " + ServiceRef.current()); if (log.isLoggable(Level.FINE)) { Thread.dumpStack(); log.fine("Updated sequence for page compare-and-set: " + " old:" + oldPage + " new:" + newPage + " " + ServiceRef.current());
@OnInit public void onInit() throws Exception { String address = ServiceRef.current().address() + _id; _logger.log(Level.CONFIG, "onInit: id=" + _id + ", service address=" + address); _jdbcConfig = JdbcConfig.from(_config, address); _logger.log(Level.CONFIG, "onInit: config=" + _jdbcConfig); Properties props = new Properties(); if (_jdbcConfig.user() != null) { props.setProperty("user", _jdbcConfig.user()); if (_jdbcConfig.pass() != null) { props.setProperty("password", _jdbcConfig.pass()); } } Supplier<JdbcConnection> supplier = new ConnectionSupplier(_jdbcConfig.url(), props, _jdbcConfig.testQueryBefore(), _jdbcConfig.testQueryAfter()); ServiceBuilder builder = Services.current().newService(JdbcConnection.class, supplier); ServiceRef ref = builder.workers(_jdbcConfig.poolSize()).start(); _conn = ref.as(JdbcConnection.class); }
ServiceRef selfRef = ServiceRef.current();
public void start() { Services manager = AmpSystem.currentManager(); EventsSync events = manager.service(EventsSync.class); /* manager.service("event:///" + ServerOnUpdate.class.getName()) .subscribe(new ServerListener()); */ events.subscriber(ServerOnUpdate.class, new ServerListener()); ServiceRef selfRef = ServiceRef.current(); PodOnUpdate listener = selfRef.pin(new PodUpdateListener()) .as(PodOnUpdate.class); /* manager.service("event:///" + PodOnUpdate.class.getName()) .subscribe(listener); */ events.subscriber(PodOnUpdate.class, listener); }
@Override public void onActive() { _isReplay = false; if (_isActive) { return; } _isActive = true; _serviceSelf = ServiceRef.current(); if (_journalDelay > 0) { Services manager = _serviceSelf.services(); _timerService = manager.service("timer:").as(Timers.class); Consumer<Cancel> startSave = h->startSave(); _startSaveRef = (Consumer<Cancel>) _serviceSelf.pin(startSave).as(Consumer.class); } super.onActive(); startSave(); }