• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

CxxJDK: C++版仿JDK类库

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

CxxJDK

开源软件地址:

https://gitee.com/cxxjava/CxxJDK

开源软件介绍:

CxxJDK

山寨JDK实现的C++强大类库.

英文版本: English

目录

特点

  • 跨平台:同时支持Linux32/64、OSX64、Win64等平台;
  • 高性能:同时具备C/C++和Java并发库的优点,性能爆棚;
  • 类丰富:实现JDK丰富的类库,从此摆脱C++贫类库的困境;
  • 易开发:先java开发,再使用CxxJDK进行翻译,So easy!

示例

java:

public static void main(String[] args) {	class Worker implements Runnable {		@Override		public void run() {			try {				Thread.sleep(1000);			} catch (InterruptedException e) {				e.printStackTrace();			}			System.out.println(String.format("thread %d finished", 				this.hashCode()));		}	}    ThreadPoolExecutor executor = new ThreadPoolExecutor(100, 200, 10, 			TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());   	executor.allowCoreThreadTimeOut(true);		for (int i = 0; i < 200; i++) {   		executor.execute(new Worker());   	}		executor.shutdown();}

c++:

int main(int argc, const char **argv) {	ESystem::init(argc, argv); //cxxjdk初始化!	class Worker : public ERunnable {	public:		virtual void run() {			try {   				EThread::sleep(1000);   			} catch (EInterruptedException& e) {   				e.printStackTrace();   			}   			ESystem::out->println(EString::formatOf("thread %d finished", 				this->hashCode()).c_str());		}	};	EThreadPoolExecutor* executor = new EThreadPoolExecutor(100, 200, 10,			ETimeUnit::SECONDS, new ELinkedBlockingQueue<ERunnable>());	executor->allowCoreThreadTimeOut(true);		for (int i = 0; i < 200; i++) {		executor->execute(new Worker());	}		executor->shutdown();	executor->awaitTermination();		delete executor; //对象资源释放!}

以上示例是不是够吸引人?

更多示例:
testefc.cpp
testnio.cpp
testbson.cpp
testc11.cpp
testssl.cpp

性能

EConcurrentHashmap测试:

软件环境:

put 20线程 && get 20线程

硬件环境:

型号名称:	MacBook Pro型号标识符:	MacBookPro10,2处理器名称:	Intel Core i5处理器速度:	2.6 GHz处理器数目:	1核总数:	2

测试结果:

test_concurrentHashmap

特性

base:
jdk类cxxjdk类
Object[]EA
AbstractCollectionEAbstractCollection
AbstractListEAbstractList
AbstractMapEAbstractMap
AbstractQueueEAbstractQueue
AbstractSetEAbstractSet
AlreadyBoundExceptionEAlreadyBoundException
ArithmeticExceptionEArithmeticException
ArrayEArray
ArrayDequeEArrayDeque
ArrayListEArrayList
ArraysEArrays
AuthenticationExceptionEAuthenticationException
Base64EBase64
BigDecimalEBigDecimal
BigIntegerEBigInteger
BindExceptionEBindException
BitSetEBitSet
BitsEBits
BooleanEBoolean
BufferedInputStreamEBufferedInputStream
BufferedOutputStreamEBufferedOutputStream
ByteEByte
ByteArrayInputStreamEByteArrayInputStream
ByteArrayOutputStreamEByteArrayOutputStream
CRC32ECRC32
CalendarECalendar
CharacterECharacter
CheckedInputStreamECheckedInputStream
ChecksumEChecksum
ClassCastExceptionEClassCastException
CollectionECollection
CollectionsECollections
ComparableEComparable
ComparatorEComparator
ConditionECondition
ConnectExceptionEConnectException
DataFormatExceptionEDataFormatException
DatagramPacketEDatagramPacket
DatagramSocketEDatagramSocket
DataInputEDataInput
DataInputStreamEDataInputStream
DataOutputEDataOutput
DataOutputStreamEDataOutputStream
DateEDate
DeflaterEDeflater
DeflaterOutputStreamEDeflaterOutputStream
DequeEDeque
DictionaryEDictionary
DoubleEDouble
EOFExceptionEEOFException
EmptyStackExceptionEEmptyStackException
EnumerationEEnumeration
EventListenerEEventListener
EventListenerProxyEEventListenerProxy
EventObjectEEventObject
ExceptionEException
FileEFile
FileInputStreamEFileInputStream
FileNotFoundExceptionEFileNotFoundException
FileOutputStreamEFileOutputStream
FilenameFilterEFilenameFilter
FilterInputStreamEFilterInputStream
FilterOutputStreamEFilterOutputStream
FloatEFloat
GZIPInputStreamEGZIPInputStream
GZIPOutputStreamEGZIPOutputStream
HashMapEHashMap
HashSetEHashSet
IOExceptionEIOException
IPAddressUtilEIPAddressUtil
IdentityHashMapEIdentityHashMap
IllegalArgumentExceptionEIllegalArgumentException
IllegalStateExceptionEIllegalStateException
IllegalThreadStateExceptionEIllegalThreadStateException
IndexOutOfBoundsExceptionEIndexOutOfBoundsException
InetAddressEInetAddress
InetSocketAddressEInetSocketAddress
InflaterEInflater
InflaterInputStreamEInflaterInputStream
InputStreamEInputStream
IntegerEInteger
InterfaceAddressEInterfaceAddress
InterruptedExceptionEInterruptedException
InterruptedIOExceptionEInterruptedIOException
InterruptibleEInterruptible
IterableEIterable
IteratorEIterator
LLongELLong
LinkedListELinkedList
ListEList
ListIteratorEListIterator
LockELock
MalformedURLExceptionEMalformedURLException
MapEMap
MatchResultEMatchResult
MatcherEMatcher
MathEMath
MulticastSocketEMulticastSocket
NavigableMapENavigableMap
NavigableSetENavigableSet
NetworkInterfaceENetworkInterface
NoRouteToHostExceptionENoRouteToHostException
NoSuchElementExceptionENoSuchElementException
NotYetBoundExceptionENotYetBoundException
NullPointerExceptionENullPointerException
NumberENumber
NumberFormatExceptionENumberFormatException
ObjectEObject
ObservableEObservable
ObserverEObserver
OutOfMemoryErrorEOutOfMemoryError
OutputStreamEOutputStream
PatternEPattern
PatternSyntaxExceptionEPatternSyntaxException
PipedInputStreamEPipedInputStream
PipedOutputStreamEPipedOutputStream
PortUnreachableExceptionEPortUnreachableException
PrintStreamEPrintStream
PriorityQueueEPriorityQueue
ProcessEProcess
ProtocolExceptionEProtocolException
QueueEQueue
RandomERandom
RandomAccessFileERandomAccessFile
ReferenceEReference
RunnableERunnable
RuntimeERuntime
RuntimeExceptionERuntimeException
SaslExceptionESaslException
SecureRandomESecureRandom
SecurityExceptionESecurityException
SentryESentry
SequenceInputStreamESequenceInputStream
ServerSocketEServerSocket
SetESet
ShortEShort
SocketESocket
SocketExceptionESocketException
SocketOptionsESocketOptions
SocketTimeoutExceptionESocketTimeoutException
SortedMapESortedMap
SortedSetESortedSet
StackEStack
StringEString
StringTokenizerEStringTokenizer
SystemESystem
ThreadEThread
ThreadGroupEThreadGroup
ThreadLocalEThreadLocal
ThreadLocalStorageEThreadLocalStorage
ThrowableEThrowable
TimeUnitETimeUnit
TimerETimer
TimerTaskETimerTask
TreeMapETreeMap
TreeSetETreeSet
URIEURI
URISyntaxExceptionEURISyntaxException
URLDecoderEURLDecoder
URLEncoderEURLEncoder
URLStringEURLString
UnknownHostExceptionEUnknownHostException
UnknownServiceExceptionEUnknownServiceException
UnsupportedAddressTypeExceptionEUnsupportedAddressTypeException
UnsupportedEncodingExceptionEUnsupportedEncodingException
UnsupportedOperationExceptionEUnsupportedOperationException
VectorEVector
try {xxx} finally {yyy}ON_FINALLY_NOTHROW(yyy) {xxx}}
concurrent:
jdk类cxxjdk类
synchronizedSYNCHRONIZED
AbstractConcurrentCollectionEAbstractConcurrentCollection
AbstractConcurrentQueueEAbstractConcurrentQueue
AbstractExecutorServiceEAbstractExecutorService
AbstractOwnableSynchronizerEAbstractOwnableSynchronizer
AbstractQueuedSynchronizerEAbstractQueuedSynchronizer
AtomicBooleanEAtomicBoolean
AtomicCounterEAtomicCounter
AtomicIntegerEAtomicInteger
AtomicLLongEAtomicLLong
AtomicReferenceEAtomicReference
BlockingQueueEBlockingQueue
BrokenBarrierExceptionEBrokenBarrierException
CallableECallable
CancellationExceptionECancellationException
CompletionServiceECompletionService
ConcurrentHashMapEConcurrentHashMap
ConcurrentLinkedQueueEConcurrentLinkedQueue
ConcurrentModificationExceptionEConcurrentModificationException
ConcurrentNavigableMapEConcurrentNavigableMap
ConcurrentSkipListMapEConcurrentSkipListMap
CopyOnWriteArrayListECopyOnWriteArrayList
CountDownLatchECountDownLatch
CyclicBarrierECyclicBarrier
ExchangerEExchanger
ExecutionExceptionEExecutionException
ExecutorEExecutor
ExecutorCompletionServiceEExecutorCompletionService
ExecutorServiceEExecutorService
ExecutorsEExecutors
FutureEFuture
FutureTaskEFutureTask
LinkedBlockingQueueELinkedBlockingQueue
LinkedTransferQueueELinkedTransferQueue
LockSupportELockSupport
ReadWriteLockEReadWriteLock
ReentrantLockEReentrantLock
ReentrantReadWriteLockEReentrantReadWriteLock
RejectedExecutionExceptionERejectedExecutionException
RejectedExecutionHandlerERejectedExecutionHandler
RunnableFutureERunnableFuture
SemaphoreESemaphore
SynchronousQueueESynchronousQueue
ThreadFactoryEThreadFactory
ThreadLocalRandomEThreadLocalRandom
ThreadPoolExecutorEThreadPoolExecutor
TimeoutExceptionETimeoutException
TransferQueueETransferQueue
UnsafeEUnsafe
Map*EConcurrentMap
SortedMap*EConcurrentSortedMap
nio:
jdk类cxxjdk类
AlreadyConnectedExceptionEAlreadyConnectedException
AsynchronousCloseExceptionEAsynchronousCloseException
BufferOverflowExceptionEBufferOverflowException
BufferUnderflowExceptionEBufferUnderflowException
ByteChannelEByteChannel
CancelledKeyExceptionECancelledKeyException
ChannelEChannel
ChannelInputStreamEChannelInputStream
ClosedByInterruptExceptionEClosedByInterruptException
ClosedChannelExceptionEClosedChannelException
ClosedSelectorExceptionEClosedSelectorException
ConnectionPendingExceptionEConnectionPendingException
DatagramChannelEDatagramChannel
FileChannelEFileChannel
FileLockEFileLock
xxByteBufferEIOByteBuffer
IllegalBlockingModeExceptionEIllegalBlockingModeException
InterruptibleChannelEInterruptibleChannel
InvalidMarkExceptionEInvalidMarkException
MappedByteBufferEMappedByteBuffer
MembershipKeyEMembershipKey
MulticastChannelEMulticastChannel
NativeThreadSetENativeThreadSet
NoConnectionPendingExceptionENoConnectionPendingException
NonReadableChannelExceptionENonReadableChannelException
NonWritableChannelExceptionENonWritableChannelException
NotYetConnectedExceptionENotYetConnectedException
OverlappingFileLockExceptionEOverlappingFileLockException
ReadOnlyBufferExceptionEReadOnlyBufferException
SelectableChannelESelectableChannel
SelectionKeyESelectionKey
SelectorESelector
ServerSocketChannelEServerSocketChannel
SocketChannelESocketChannel
UnresolvedAddressExceptionEUnresolvedAddressException
other:
cxxjdk类类描述
EConfig应用配置管理
EByteBuffer二进制数据缓存
ESharedPtrC++智能指针
ELockPoolSpinLock池化管理类
EOrderAccess内存访问模型辅助类
EForkUnix/Linux系统下的进程创建
ESimpleConditionC++ style condition
ESimpleLockC++ style mutex lock
ESpinLockC++ wrapper for spin lock
ESimpleMapC++ wrapper for map table
ESimpleStackC++ wrapper for stack
ESimpleVectorC++ wrapper for vector
ESimpleEnumerationEnumeration for ESimpleXXX
EStreamIO数据流操作类
EOS操作系统相关工具类
EAtomic原子操作类
EScopeGuardC++11风格封装的通过局部变量析构函数来管理资源的辅助类
EAtomicDoubledouble原子操作类
ENetWrappersocket操作辅助工具类
EDomainSocketUnix Domain Socket
EDomainServerSocketUnix Domain Server Socket

手册

详见Guide文档

TODO

java.security.*;

Support

Email: [email protected]


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap