mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 02:45:22 +00:00
THRIFT-366. java: Lots of little warnings in java library
This cleans up imports, adds generic arguments where necessary, and puts OverloadNonblockingServer into the right package. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@753072 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
56c4836220
commit
0096b20883
@ -13,10 +13,10 @@ public class FieldMetaData implements java.io.Serializable {
|
||||
public final String fieldName;
|
||||
public final byte requirementType;
|
||||
public final FieldValueMetaData valueMetaData;
|
||||
private static Map<Class<? extends TBase>, Map> structMap;
|
||||
private static Map<Class<? extends TBase>, Map<Integer, FieldMetaData>> structMap;
|
||||
|
||||
static {
|
||||
structMap = new HashMap<Class<? extends TBase>, Map>();
|
||||
structMap = new HashMap<Class<? extends TBase>, Map<Integer, FieldMetaData>>();
|
||||
}
|
||||
|
||||
public FieldMetaData(String name, byte req, FieldValueMetaData vMetaData){
|
||||
@ -25,7 +25,7 @@ public class FieldMetaData implements java.io.Serializable {
|
||||
this.valueMetaData = vMetaData;
|
||||
}
|
||||
|
||||
public static void addStructMetaDataMap(Class<? extends TBase> sClass, Map map){
|
||||
public static void addStructMetaDataMap(Class<? extends TBase> sClass, Map<Integer, FieldMetaData> map){
|
||||
structMap.put(sClass, map);
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
package org.apache.thrift.meta_data;
|
||||
|
||||
import org.apache.thrift.TBase;
|
||||
|
||||
public class StructMetaData extends FieldValueMetaData {
|
||||
public final Class structClass;
|
||||
public final Class<? extends TBase> structClass;
|
||||
|
||||
public StructMetaData(byte type, Class sClass){
|
||||
public StructMetaData(byte type, Class<? extends TBase> sClass){
|
||||
super(type);
|
||||
this.structClass = sClass;
|
||||
}
|
||||
|
@ -1,27 +1,17 @@
|
||||
|
||||
package org.apache.thrift.server;
|
||||
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.TProcessor;
|
||||
import org.apache.thrift.TProcessorFactory;
|
||||
import org.apache.thrift.protocol.TProtocol;
|
||||
import org.apache.thrift.protocol.TProtocolFactory;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
import org.apache.thrift.transport.TNonblockingServerTransport;
|
||||
import org.apache.thrift.transport.TTransport;
|
||||
import org.apache.thrift.transport.TFramedTransport;
|
||||
import org.apache.thrift.transport.TNonblockingTransport;
|
||||
import org.apache.thrift.transport.TTransportException;
|
||||
import org.apache.thrift.transport.TTransportFactory;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.apache.thrift.TProcessor;
|
||||
import org.apache.thrift.TProcessorFactory;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
import org.apache.thrift.protocol.TProtocolFactory;
|
||||
import org.apache.thrift.transport.TFramedTransport;
|
||||
import org.apache.thrift.transport.TNonblockingServerTransport;
|
||||
|
||||
/**
|
||||
* An extension of the TNonblockingServer to a Half-Sync/Half-Async server.
|
||||
|
@ -1,44 +1,31 @@
|
||||
|
||||
package org.apache.thrift.server;
|
||||
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.TProcessor;
|
||||
import org.apache.thrift.TProcessorFactory;
|
||||
import org.apache.thrift.protocol.TProtocol;
|
||||
import org.apache.thrift.protocol.TProtocolFactory;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
import org.apache.thrift.transport.TNonblockingServerTransport;
|
||||
import org.apache.thrift.transport.TIOStreamTransport;
|
||||
import org.apache.thrift.transport.TTransport;
|
||||
import org.apache.thrift.transport.TFramedTransport;
|
||||
import org.apache.thrift.transport.TNonblockingTransport;
|
||||
import org.apache.thrift.transport.TTransportException;
|
||||
import org.apache.thrift.transport.TTransportFactory;
|
||||
import org.apache.thrift.TByteArrayOutputStream;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.Iterator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.SelectionKey;
|
||||
import java.nio.channels.Selector;
|
||||
import java.nio.channels.spi.SelectorProvider;
|
||||
import java.util.HashSet;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.Selector;
|
||||
import java.nio.channels.SelectionKey;
|
||||
import java.nio.channels.spi.SelectorProvider;
|
||||
import java.nio.channels.CancelledKeyException;
|
||||
import java.nio.channels.ClosedChannelException;
|
||||
import org.apache.thrift.TByteArrayOutputStream;
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.TProcessor;
|
||||
import org.apache.thrift.TProcessorFactory;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
import org.apache.thrift.protocol.TProtocol;
|
||||
import org.apache.thrift.protocol.TProtocolFactory;
|
||||
import org.apache.thrift.transport.TFramedTransport;
|
||||
import org.apache.thrift.transport.TIOStreamTransport;
|
||||
import org.apache.thrift.transport.TNonblockingServerTransport;
|
||||
import org.apache.thrift.transport.TNonblockingTransport;
|
||||
import org.apache.thrift.transport.TTransport;
|
||||
import org.apache.thrift.transport.TTransportException;
|
||||
|
||||
/**
|
||||
* A nonblocking TServer implementation. This allows for fairness amongst all
|
||||
|
@ -4,14 +4,12 @@ package org.apache.thrift.transport;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
|
||||
import java.nio.channels.ClosedChannelException;
|
||||
import java.nio.channels.SelectionKey;
|
||||
import java.nio.channels.Selector;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.nio.channels.SelectionKey;
|
||||
import java.nio.channels.ClosedChannelException;
|
||||
|
||||
/**
|
||||
* Wrapper around ServerSocketChannel
|
||||
|
@ -1,17 +1,13 @@
|
||||
|
||||
package org.apache.thrift.transport;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.nio.channels.SelectionKey;
|
||||
import java.nio.channels.Selector;
|
||||
import java.nio.channels.SocketChannel;
|
||||
|
||||
/**
|
||||
* Socket implementation of the TTransport interface. To be commented soon!
|
||||
|
@ -1,24 +1,23 @@
|
||||
package org.apache.thrift.test;
|
||||
|
||||
// Generated code
|
||||
import thrift.test.*;
|
||||
|
||||
import org.apache.thrift.TSerializer;
|
||||
import org.apache.thrift.TDeserializer;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
import org.apache.thrift.protocol.TSimpleJSONProtocol;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.thrift.TDeserializer;
|
||||
import org.apache.thrift.TSerializer;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
|
||||
import thrift.test.Bonk;
|
||||
import thrift.test.HolyMoley;
|
||||
import thrift.test.Nesting;
|
||||
import thrift.test.OneOfEach;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -1,17 +1,19 @@
|
||||
package org.apache.thrift.test;
|
||||
|
||||
// Generated code
|
||||
import thrift.test.*;
|
||||
|
||||
import org.apache.thrift.transport.TMemoryBuffer;
|
||||
import org.apache.thrift.protocol.TJSONProtocol;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.thrift.protocol.TJSONProtocol;
|
||||
import org.apache.thrift.transport.TMemoryBuffer;
|
||||
|
||||
import thrift.test.Base64;
|
||||
import thrift.test.Bonk;
|
||||
import thrift.test.HolyMoley;
|
||||
import thrift.test.Nesting;
|
||||
import thrift.test.OneOfEach;
|
||||
|
||||
/**
|
||||
* Tests for the Java implementation of TJSONProtocol. Mirrors the C++ version
|
||||
|
@ -40,10 +40,10 @@ public class JavaBeansTest {
|
||||
// Everything is set
|
||||
ooe.set_a_bite((byte) 1);
|
||||
ooe.set_base64("bytes".getBytes());
|
||||
ooe.set_byte_list(new LinkedList());
|
||||
ooe.set_byte_list(new LinkedList<Byte>());
|
||||
ooe.set_double_precision(1);
|
||||
ooe.set_i16_list(new LinkedList());
|
||||
ooe.set_i64_list(new LinkedList());
|
||||
ooe.set_i16_list(new LinkedList<Short>());
|
||||
ooe.set_i64_list(new LinkedList<Long>());
|
||||
ooe.set_boolean_field(true);
|
||||
ooe.set_integer16((short) 1);
|
||||
ooe.set_integer32(1);
|
||||
|
@ -14,9 +14,7 @@ import thrift.test.*;
|
||||
public class MetaDataTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
CrazyNesting cn = new CrazyNesting();
|
||||
Insanity in = new Insanity();
|
||||
Map<Integer, FieldMetaData> mdMap = cn.metaDataMap;
|
||||
Map<Integer, FieldMetaData> mdMap = CrazyNesting.metaDataMap;
|
||||
|
||||
// Check for struct fields existence
|
||||
if (mdMap.size() != 3)
|
||||
@ -53,8 +51,8 @@ public class MetaDataTest {
|
||||
FieldMetaData.getStructMetaDataMap(Insanity.class) == null ||
|
||||
FieldMetaData.getStructMetaDataMap(Xtruct.class) == null)
|
||||
throw new RuntimeException("global metadata map doesn't contain an entry for a known struct");
|
||||
if (FieldMetaData.getStructMetaDataMap(CrazyNesting.class) != cn.metaDataMap ||
|
||||
FieldMetaData.getStructMetaDataMap(Insanity.class) != in.metaDataMap)
|
||||
if (FieldMetaData.getStructMetaDataMap(CrazyNesting.class) != CrazyNesting.metaDataMap ||
|
||||
FieldMetaData.getStructMetaDataMap(Insanity.class) != Insanity.metaDataMap)
|
||||
throw new RuntimeException("global metadata map contains wrong entry for a loaded struct");
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,8 @@
|
||||
|
||||
package org.apache.thrift;
|
||||
package org.apache.thrift.test;
|
||||
|
||||
import thrift.test.*;
|
||||
|
||||
import org.apache.thrift.TApplicationException;
|
||||
import org.apache.thrift.TSerializer;
|
||||
import org.apache.thrift.transport.TTransport;
|
||||
import org.apache.thrift.transport.TSocket;
|
||||
import org.apache.thrift.transport.TFramedTransport;
|
||||
import org.apache.thrift.transport.TTransportException;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
import org.apache.thrift.protocol.TSimpleJSONProtocol;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import org.apache.thrift.transport.TSocket;
|
||||
|
||||
|
||||
public class OverloadNonblockingServer {
|
||||
|
@ -1,14 +1,27 @@
|
||||
|
||||
package org.apache.thrift.test;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.thrift.transport.*;
|
||||
import org.apache.thrift.server.*;
|
||||
import org.apache.thrift.protocol.*;
|
||||
import org.apache.thrift.*;
|
||||
import org.apache.thrift.TBase;
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
import org.apache.thrift.protocol.TCompactProtocol;
|
||||
import org.apache.thrift.protocol.TField;
|
||||
import org.apache.thrift.protocol.TMessage;
|
||||
import org.apache.thrift.protocol.TMessageType;
|
||||
import org.apache.thrift.protocol.TProtocol;
|
||||
import org.apache.thrift.protocol.TProtocolFactory;
|
||||
import org.apache.thrift.protocol.TStruct;
|
||||
import org.apache.thrift.protocol.TType;
|
||||
import org.apache.thrift.transport.TMemoryBuffer;
|
||||
|
||||
import thrift.test.*;
|
||||
import thrift.test.CompactProtoTestStruct;
|
||||
import thrift.test.HolyMoley;
|
||||
import thrift.test.Nesting;
|
||||
import thrift.test.OneOfEach;
|
||||
import thrift.test.Srv;
|
||||
|
||||
public class TCompactProtocolTest {
|
||||
|
||||
|
@ -1,27 +1,11 @@
|
||||
package org.apache.thrift.test;
|
||||
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
import org.apache.thrift.protocol.TProtocol;
|
||||
import org.apache.thrift.protocol.TProtocolFactory;
|
||||
import org.apache.thrift.server.TServer;
|
||||
import org.apache.thrift.server.TSimpleServer;
|
||||
import org.apache.thrift.server.TNonblockingServer;
|
||||
import org.apache.thrift.server.THsHaServer;
|
||||
import org.apache.thrift.server.TNonblockingServer;
|
||||
import org.apache.thrift.server.TServer;
|
||||
import org.apache.thrift.transport.TNonblockingServerSocket;
|
||||
import org.apache.thrift.transport.TNonblockingServerTransport;
|
||||
import org.apache.thrift.transport.TFramedTransport;
|
||||
|
||||
// Generated code
|
||||
import thrift.test.*;
|
||||
|
||||
import java.net.ServerSocket;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import thrift.test.ThriftTest;
|
||||
|
||||
|
||||
public class TestNonblockingServer extends TestServer {
|
||||
|
@ -1,25 +1,24 @@
|
||||
package org.apache.thrift.test;
|
||||
|
||||
import org.apache.thrift.TException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
import org.apache.thrift.protocol.TProtocol;
|
||||
import org.apache.thrift.protocol.TProtocolFactory;
|
||||
import org.apache.thrift.server.TServer;
|
||||
import org.apache.thrift.server.TSimpleServer;
|
||||
import org.apache.thrift.server.TThreadPoolServer;
|
||||
import org.apache.thrift.transport.TServerSocket;
|
||||
import org.apache.thrift.transport.TServerTransport;
|
||||
|
||||
// Generated code
|
||||
import thrift.test.*;
|
||||
|
||||
import java.net.ServerSocket;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import thrift.test.Insanity;
|
||||
import thrift.test.Numberz;
|
||||
import thrift.test.ThriftTest;
|
||||
import thrift.test.Xception;
|
||||
import thrift.test.Xception2;
|
||||
import thrift.test.Xtruct;
|
||||
import thrift.test.Xtruct2;
|
||||
|
||||
public class TestServer {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user