public String className() { return TypeMap.className(_type); }
@Override public void compute2() { _clazz = TypeMap.className(_id); tryComplete(); } @Override public byte priority() { return H2O.FETCH_ACK_PRIORITY; }
protected boolean matchesType(H2O.KeyInfo ki) { // No type filtering if( _typeid == 0 && _cname == null ) return true; // One-shot monotonic racey update from 0 to the known fixed typeid. // Since all writers write the same typeid, there is no race. if( _typeid == 0 ) _typeid = TypeMap.onIce(_cname); if( ki._type == _typeid ) return true; // Class Model is abstract, and TypeMap clazz() does not handle that well. // Also, want to allow both OldModel & Model. // Hack: check for water.Model and name the class directly. Class kclz = TypeMap.clazz(ki._type); if( TypeMap.className(_typeid).equals("water.Model") ) return Model.class.isAssignableFrom(kclz); return TypeMap.clazz(_typeid).isAssignableFrom(kclz); }
static public Iced newInstance(int id) { if( id >= CLAZZES.length || CLAZZES[id] == null ) loadId(id); Iced f = (Iced) GOLD[id]; if( f == null ) { try { GOLD[id] = f = (Iced) Class.forName(CLAZZES[id]).newInstance(); } catch( Exception e ) { Log.err("Failed newinstance for class "+className(id)); throw Log.errRTExcept(e); } } return f.newInstance(); }
@Override public String print16( AutoBuffer ab ) { int flag = ab.getFlag(); String clazz = (flag == CLIENT_UDP_SEND) ? TypeMap.className(ab.get2()) : ""; return "task# "+ab.getTask()+" "+ clazz+" "+COOKIES[flag-SERVER_UDP_SEND]; } }
/** Creates a Stream for reading bytes */ public InputStream openStream(ProgressMonitor p) throws IOException { if(onNFS() ) return PersistNFS .openStream(_key ); if(onHDFS()) return PersistHdfs.openStream(_key,p); if(onS3() ) return PersistS3 .openStream(_key,p); if(onTachyon()) return PersistTachyon.openStream(_key,p); if( isFrame() ) throw new IllegalArgumentException("Tried to pass a Frame to openStream (maybe tried to parse a (already-parsed) Frame?)"); assert _type==TypeMap.PRIM_B : "Expected byte[] type but got "+TypeMap.className(_type); return new ByteArrayInputStream(memOrLoad()); }