@SuppressWarnings("unchecked") public <T extends IMetric> T registerMetric(String name, T metric, int timeBucketSizeInSecs) { if ((Boolean) _openOrPrepareWasCalled.deref()) { throw new RuntimeException("TopologyContext.registerMetric can only be called from within overridden " + "IBolt::prepare() or ISpout::open() method.");
@SuppressWarnings("rawtypes") public Task(WorkerData workerData, int taskId) throws Exception { openOrPrepareWasCalled = new Atom(false);
public Object swap(IFn f, Object arg1, Object arg2) { for(; ;) { Object v = deref(); Object newv = f.invoke(v, arg1, arg2); validate(newv); if(state.compareAndSet(v, newv)) { notifyWatches(v, newv); return newv; } } }
public boolean compareAndSet(Object oldv, Object newv){ validate(newv); boolean ret = state.compareAndSet(oldv, newv); if(ret) notifyWatches(oldv, newv); return ret; }
public Object swap(IFn f, Object arg) { for(; ;) { Object v = deref(); Object newv = f.invoke(v, arg); validate(newv); if(state.compareAndSet(v, newv)) { notifyWatches(v, newv); return newv; } } }
public boolean compareAndSet(Object oldv, Object newv){ validate(newv); boolean ret = state.compareAndSet(oldv, newv); if(ret) notifyWatches(oldv, newv); return ret; }
public Object swap(IFn f) { for(; ;) { Object v = deref(); Object newv = f.invoke(v); validate(newv); if(state.compareAndSet(v, newv)) { notifyWatches(v, newv); return newv; } } }
public <T extends IMetric> T registerMetric(String name, T metric, int timeBucketSizeInSecs) { if((Boolean)_openOrPrepareWasCalled.deref() == true) { throw new RuntimeException("TopologyContext.registerMetric can only be called from within overridden " + "IBolt::prepare() or ISpout::open() method."); } if (metric == null) { throw new IllegalArgumentException("Cannot register a null metric"); } if (timeBucketSizeInSecs <= 0) { throw new IllegalArgumentException("TopologyContext.registerMetric can only be called with timeBucketSizeInSecs " + "greater than or equal to 1 second."); } Map m1 = _registeredMetrics; if(!m1.containsKey(timeBucketSizeInSecs)) { m1.put(timeBucketSizeInSecs, new HashMap()); } Map m2 = (Map)m1.get(timeBucketSizeInSecs); if(!m2.containsKey(_taskId)) { m2.put(_taskId, new HashMap()); } Map m3 = (Map)m2.get(_taskId); if(m3.containsKey(name)) { throw new RuntimeException("The same metric name `" + name + "` was registered twice." ); } else { m3.put(name, metric); } return metric; }
public Object reset(Object newval){ Object oldval = state.get(); validate(newval); state.set(newval); notifyWatches(oldval, newval); return newval; } }
List<Atom> atoms = new ArrayList<Atom>(); atoms.add(new Atom(4,1)); int nucleus = atoms.get(0).getNucleus(); // Assuming you've written your getter method. int satellite = atoms.get(0).getSatellite();
public Object swap(IFn f, Object arg1, Object arg2) { for(; ;) { Object v = deref(); Object newv = f.invoke(v, arg1, arg2); validate(newv); if(state.compareAndSet(v, newv)) { notifyWatches(v, newv); return newv; } } }
@Deprecated public <T extends IMetric> T registerMetric(String name, T metric, int timeBucketSizeInSecs) { if((Boolean) _openOrPrepareWasCalled.deref()) { throw new RuntimeException("TopologyContext.registerMetric can only be called from within overridden " + "IBolt::prepare() or ISpout::open() method.");
public Object reset(Object newval){ Object oldval = state.get(); validate(newval); state.set(newval); notifyWatches(oldval, newval); return newval; } }
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash_screen); loading = (TextView) findViewById(R.id.textView2); try { a = (Atom) new Atom().execute(null,null,null); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); finish(); } }
public Object swap(IFn f) { for(; ;) { Object v = deref(); Object newv = f.invoke(v); validate(newv); if(state.compareAndSet(v, newv)) { notifyWatches(v, newv); return newv; } } }
public <T extends IMetric> T registerMetric(String name, T metric, int timeBucketSizeInSecs) { if ((Boolean) _openOrPrepareWasCalled.deref() == true) { throw new RuntimeException("TopologyContext.registerMetric can only be called from within overridden " + "IBolt::prepare() or ISpout::open() method.");
loading = (TextView) findViewById(R.id.textView2); try { a = (Atom) new Atom().execute(null,null,null); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); finish(); }
public Object swap(IFn f, Object arg) { for(; ;) { Object v = deref(); Object newv = f.invoke(v, arg); validate(newv); if(state.compareAndSet(v, newv)) { notifyWatches(v, newv); return newv; } } }
public Model read(final Reader input, final Map<String, ?> options) throws IOException { assert input != null; try { String location = PolyglotModelUtil.getLocation(options); final Var USE = Var.intern(RT.CLOJURE_NS, Symbol.create("use")); final Symbol READER = Symbol.create("org.sonatype.maven.polyglot.clojure.dsl.reader"); final Symbol LEININGEN = Symbol.create("org.sonatype.maven.polyglot.clojure.dsl.leiningen"); USE.invoke(READER); USE.invoke(LEININGEN); clojure.lang.Compiler.load(input, location, location); final Var MODEL = Var.intern(Namespace.findOrCreate(READER), Symbol.create("*MODEL*")); return (Model) ((Atom) MODEL.get()).deref(); } catch (Exception e) { // Don't use new IOException(e) because it doesn't exist in Java 5 throw (IOException) new IOException(e.toString()).initCause(e); } } }
try { loading = (TextView) findViewById(R.id.textView2); a = (Atom) new Atom().execute(null,null,null); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); finish(); }