@Override public synchronized void bindMetadataNodeStub(CcId ccId) throws RemoteException { if (metadataNodeStub == null) { throw new IllegalStateException("Metadata node not exported"); } //noinspection unchecked ((ConcurrentMap<CcId, IAsterixStateProxy>) getServiceContext().getDistributedState()).get(ccId) .setMetadataNode(metadataNodeStub); }
@Override public synchronized void init() throws HyracksDataException { if (metadataNode != null && !rebindMetadataNode) { return; } try { metadataNode = proxies.iterator().next() .waitForMetadataNode(metadataProperties.getRegistrationTimeoutSecs(), TimeUnit.SECONDS); if (metadataNode != null) { rebindMetadataNode = false; } else { throw new HyracksDataException("The MetadataNode failed to bind before the configured timeout (" + metadataProperties.getRegistrationTimeoutSecs() + " seconds); the MetadataNode was " + "configured to run on NC: " + metadataProperties.getMetadataNodeName()); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw HyracksDataException.create(e); } catch (RemoteException e) { throw new RuntimeDataException(ErrorCode.REMOTE_EXCEPTION_WHEN_CALLING_METADATA_NODE, e); } super.init(); } }