Java Code Examples for org.apache.hadoop.ipc.ProtocolSignature

The following examples show how to use org.apache.hadoop.ipc.ProtocolSignature. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  if (!protocol.equals(RPC.getProtocolName(HAServiceProtocolPB.class))) {
    throw new IOException("Serverside implements " +
        RPC.getProtocolName(HAServiceProtocolPB.class) +
        ". The following requested protocol is unknown: " + protocol);
  }

  return ProtocolSignature.getProtocolSignature(clientMethodsHash,
      RPC.getProtocolVersion(HAServiceProtocolPB.class),
      HAServiceProtocolPB.class);
}
 
Example 2
Source Project: hadoop   Source File: ZKFCProtocolServerSideTranslatorPB.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  if (!protocol.equals(RPC.getProtocolName(ZKFCProtocolPB.class))) {
    throw new IOException("Serverside implements " +
        RPC.getProtocolName(ZKFCProtocolPB.class) +
        ". The following requested protocol is unknown: " + protocol);
  }

  return ProtocolSignature.getProtocolSignature(clientMethodsHash,
      RPC.getProtocolVersion(ZKFCProtocolPB.class),
      HAServiceProtocolPB.class);
}
 
Example 3
@Override
public ProtocolSignature getProtocolSignature(String protocol,
        long clientVersion, int clientMethodsHash) throws IOException {
  if (!protocol.equals(RPC.getProtocolName(TraceAdminProtocolPB.class))) {
    throw new IOException("Serverside implements " +
        RPC.getProtocolName(TraceAdminProtocolPB.class) +
        ". The following requested protocol is unknown: " + protocol);
  }
  return ProtocolSignature.getProtocolSignature(clientMethodsHash,
      RPC.getProtocolVersion(TraceAdminProtocolPB.class),
      TraceAdminProtocolPB.class);
}
 
Example 4
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  if (!protocol.equals(RPC.getProtocolName(HAServiceProtocolPB.class))) {
    throw new IOException("Serverside implements " +
        RPC.getProtocolName(HAServiceProtocolPB.class) +
        ". The following requested protocol is unknown: " + protocol);
  }

  return ProtocolSignature.getProtocolSignature(clientMethodsHash,
      RPC.getProtocolVersion(HAServiceProtocolPB.class),
      HAServiceProtocolPB.class);
}
 
Example 5
Source Project: big-c   Source File: ZKFCProtocolServerSideTranslatorPB.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  if (!protocol.equals(RPC.getProtocolName(ZKFCProtocolPB.class))) {
    throw new IOException("Serverside implements " +
        RPC.getProtocolName(ZKFCProtocolPB.class) +
        ". The following requested protocol is unknown: " + protocol);
  }

  return ProtocolSignature.getProtocolSignature(clientMethodsHash,
      RPC.getProtocolVersion(ZKFCProtocolPB.class),
      HAServiceProtocolPB.class);
}
 
Example 6
@Override
public ProtocolSignature getProtocolSignature(String protocol,
        long clientVersion, int clientMethodsHash) throws IOException {
  if (!protocol.equals(RPC.getProtocolName(TraceAdminProtocolPB.class))) {
    throw new IOException("Serverside implements " +
        RPC.getProtocolName(TraceAdminProtocolPB.class) +
        ". The following requested protocol is unknown: " + protocol);
  }
  return ProtocolSignature.getProtocolSignature(clientMethodsHash,
      RPC.getProtocolVersion(TraceAdminProtocolPB.class),
      TraceAdminProtocolPB.class);
}
 
Example 7
Source Project: RDFS   Source File: TestDFSClientUpdateNameNodeSignature.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * This function tests the method signature fingerprint passed back from
 * name-node with MetaInfo is correct.
 */
@SuppressWarnings("unchecked")
public void testNameNodeFingerprintSent() throws IOException {
  InetSocketAddress addr = cluster.getNameNode().getNameNodeDNAddress();
  DFSClient client = new DFSClient(addr, cluster.getNameNode().getConf());

  client.namenode.create("/testNameNodeFingerprintSent.txt", FsPermission
      .getDefault(), client.getClientName(), true, (short)1, 65535L);

  
  Class<? extends VersionedProtocol> inter;
  try {
    inter = (Class<? extends VersionedProtocol>)Class.forName(ClientProtocol.class.getName());
  } catch (Exception e) {
    throw new IOException(e);
  }
  long serverVersion = ClientProtocol.versionID;
  int serverFpFromNn = ProtocolSignature.getFingerprint(ProtocolSignature.getProtocolSignature(
      0, serverVersion, inter).getMethods());
  
  LocatedBlockWithMetaInfo loc = client.namenode.addBlockAndFetchMetaInfo("/testNameNodeFingerprintSent.txt",
      client.getClientName(), null, 0L);
  
  int serverFp = loc.getMethodFingerPrint();
  TestCase.assertEquals(serverFpFromNn, serverFp);    

  FileSystem fs = cluster.getFileSystem();
  Path f = new Path("/testNameNodeFingerprintSent1.txt");
  DataOutputStream a_out = fs.create(f);
  a_out.writeBytes("something");
  a_out.close();
  
  LocatedBlocksWithMetaInfo locs = client.namenode.openAndFetchMetaInfo("/testNameNodeFingerprintSent.txt",
      0L, 0L);
  TestCase.assertEquals(locs.getMethodFingerPrint(), serverFp);    
}
 
Example 8
Source Project: RDFS   Source File: ProxyJobTracker.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(
  String protocol,
  long clientVersion,
  int clientMethodsHash) throws IOException {
  return ProtocolSignature.getProtocolSignature(
    this, protocol, clientVersion, clientMethodsHash);
}
 
Example 9
Source Project: RDFS   Source File: DistributedAvatarFileSystem.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(final String protocol,
    final long clientVersion, final int clientMethodsHash) throws IOException {
  return (new ImmutableFSCaller<ProtocolSignature>() {

    @Override
    ProtocolSignature call() throws IOException {
      return namenode.getProtocolSignature(
          protocol, clientVersion, clientMethodsHash);
    }

  }).callFS();
}
 
Example 10
Source Project: Bats   Source File: StreamingContainerParent.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException
{
  return ProtocolSignature.getProtocolSignature(this, protocol, clientVersion, clientMethodsHash);
}
 
Example 11
Source Project: Bats   Source File: StramLocalCluster.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol, long clientVersion, int clientMethodsHash) throws IOException
{
  throw new UnsupportedOperationException("not implemented in local mode");
}
 
Example 12
@Override
public ProtocolSignature getProtocolSignature(String protocol, long clientVersion, int clientMethodsHash) throws IOException {
    return this.proxy.getProtocolSignature(protocol, clientVersion, clientMethodsHash);
}
 
Example 13
@Override
public ProtocolSignature getProtocolSignature(String protocol, long clientVersion, int clientMethodsHash) throws IOException {
    return null;
}
 
Example 14
Source Project: XLearning   Source File: ApplicationContainerListener.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(
    String protocol, long clientVersion, int clientMethodsHash) throws IOException {
  return ProtocolSignature.getProtocolSignature(this, protocol,
      clientVersion, clientMethodsHash);
}
 
Example 15
Source Project: XLearning   Source File: ApplicationMessageService.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
                                              long clientVersion, int clientMethodsHash) throws IOException {
  return ProtocolSignature.getProtocolSignature(this, protocol,
      clientVersion, clientMethodsHash);
}
 
Example 16
Source Project: hadoop   Source File: TaskAttemptListenerImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  return ProtocolSignature.getProtocolSignature(this, 
      protocol, clientVersion, clientMethodsHash);
}
 
Example 17
Source Project: hadoop   Source File: YARNRunner.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  return ProtocolSignature.getProtocolSignature(this, protocol, clientVersion,
      clientMethodsHash);
}
 
Example 18
Source Project: hadoop   Source File: TestMapProgress.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  return ProtocolSignature.getProtocolSignature(
      this, protocol, clientVersion, clientMethodsHash);
}
 
Example 19
Source Project: hadoop   Source File: TestTaskCommit.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  return null;
}
 
Example 20
Source Project: hadoop   Source File: LocalJobRunner.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  return ProtocolSignature.getProtocolSignature(
      this, protocol, clientVersion, clientMethodsHash);
}
 
Example 21
Source Project: hadoop   Source File: LocalJobRunner.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  return ProtocolSignature.getProtocolSignature(
      this, protocol, clientVersion, clientMethodsHash);
}
 
Example 22
Source Project: hadoop   Source File: TestDoAsEffectiveUser.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  return new ProtocolSignature(TestProtocol.versionID, null);
}
 
Example 23
Source Project: ytk-mp4j   Source File: Server.java    License: MIT License 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol, long clientVersion, int clientMethodsHash) throws IOException {
    return new ProtocolSignature(IServer.versionID, null);
}
 
Example 24
Source Project: big-c   Source File: TaskAttemptListenerImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  return ProtocolSignature.getProtocolSignature(this, 
      protocol, clientVersion, clientMethodsHash);
}
 
Example 25
Source Project: big-c   Source File: YARNRunner.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  return ProtocolSignature.getProtocolSignature(this, protocol, clientVersion,
      clientMethodsHash);
}
 
Example 26
Source Project: big-c   Source File: TestMapProgress.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  return ProtocolSignature.getProtocolSignature(
      this, protocol, clientVersion, clientMethodsHash);
}
 
Example 27
Source Project: big-c   Source File: TestTaskCommit.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  return null;
}
 
Example 28
Source Project: big-c   Source File: LocalJobRunner.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  return ProtocolSignature.getProtocolSignature(
      this, protocol, clientVersion, clientMethodsHash);
}
 
Example 29
Source Project: big-c   Source File: LocalJobRunner.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  return ProtocolSignature.getProtocolSignature(
      this, protocol, clientVersion, clientMethodsHash);
}
 
Example 30
Source Project: big-c   Source File: TestDoAsEffectiveUser.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProtocolSignature getProtocolSignature(String protocol,
    long clientVersion, int clientMethodsHash) throws IOException {
  return new ProtocolSignature(TestProtocol.versionID, null);
}