Giter Club home page Giter Club logo

softindex / datakernel Goto Github PK

View Code? Open in Web Editor NEW
97.0 97.0 16.0 26.28 MB

Alternative Java platform, built from the ground up - with its own async I/O core and DI. Ultra high-performance, simple and minimalistic - redefines server-side programming, web-development and highload!

Home Page: https://datakernel.io

License: Apache License 2.0

Java 99.94% HTML 0.02% Dockerfile 0.01% Shell 0.01% TSQL 0.03%
async bytecode crdt dependency-injection highload java lsmt microservice ot promise rpc serialization web-server

datakernel's People

Contributors

anatoliivorobiov avatar based2 avatar dmitriytkachenko avatar dvolvach avatar eduard-vasinskyi avatar fly-style avatar lightzebra avatar smert avatar stasyzon avatar valerialistratova avatar vmykh avatar yevheniikravchuk avatar yevheniikravchukold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

datakernel's Issues

More Complete Module Documentation for those who are new and Unfamiliar of the Project and the Different Maven Artifacts

There are 61 Maven artefacts: https://mvnrepository.com/artifact/io.datakernel?p=1&sort=newest

Some artefacts are very similar in name. E.g.: datakernel-launchers-common, datakernel-launchers-http, http-launchers, datakernel-launcher, datakernel-http.

This is making it confusing what artefacts to add to the project as https://datakernel.io/docs/core/http.html does not give what dependencies to add.

Assuming datakernel-launchers-common refers to: https://github.com/softindex/datakernel/tree/master/launchers/common there is no readme there also specifying what this does.

Elsewhere also the documentation is very thin: https://github.com/softindex/datakernel/tree/master/core-http and the referring link is broken: https://datakernel.io/docs/components/core/http.html

Also, some module documentation does not refer to what the relevant artefacts are. E.g. https://datakernel.io/docs/core/http.html

[Documentation] "... not found" or problem when importing with maven

Hi.

There is a problem with the documentation here and there that deals with versions of datakernel.

It is indicated to use the 2.0.9-SNAPSHOT version, but the actual one is 2.4.0-SNAPSHOT.

<dependency>
    <groupId>io.datakernel</groupId>
    <artifactId>datakernel-http</artifactId>
    <version>2.0.9-SNAPSHOT</version>
</dependency>

and

<dependency>
     <groupId>io.datakernel</groupId>
     <artifactId>datakernel-eventloop</artifactId>
     <version>2.0.9-SNAPSHOT</version>
</dependency>

should be replaced accordingly -- at least that is what I've done in order for my project to use datakernel.

Add Automatic Module Names

The duplicate package names should not be used in multiple modules. Add Automatic Module Names for better integration with java 9+ modular applications.Make it future proof.

WebSockets

Is it possible to add WebSockets support?

Examples with commonly used components

For a framework that puts "SPEED" first it would be great to also show some examples with commonly used components like:
Aerospike (https://aerospike.com/docs/client/java/usage/async/index.html)
Redis (https://lettuce.io/core/release/reference/#asynchronous-api.examples) and
Kafka,
Grpc clients.

Also because Aerospike client and Redis client have their own EventLoops and combinantion of CompletableFuture and datakernel Promises is important to use existing java component ecosystem.

codegen: multiple interfaces

Is it possible to define multiple types for the AsmBuilder? I've just started using codegen and was hoping to construct a new classes that implements two existing interfaces. But I can't find any methods for adding additional types to the AsmBuilder.

Web RPC, Datastreams & Data Channels With JS Client

Can we have JS Client which can be on the browser which can communicate with the server using a higher abstraction like RPC, Datastreams and/or Data Channels?

This can perhaps just providing a JS implementation of:

  • RPC
  • CSP
  • Datastreams
  • Dataflow
  • Serialisation
  • Codec

JS implementation will be to use it from the web.

JS side can also have DI implementation.

datakernel server and its referenced objects not garbage collected after server shutdown and not having any strong reference

datakernel server and its referenced objects not garbage collected after server shutdown and while not having any strong reference.


public class Main {

	static WeakReference<DataKernelServerService> reference;
	static WeakReference<DummyThnread> dummyReference;
	
	public static void main(String[] args) throws Exception {
		start();
		stop();
		for (int i = 0; i < 10; i++) {
			System.gc();
			System.out.println("kernel finalized : "+(reference.get() == null));
			System.out.println("dummy finalized : "+(dummyReference.get()  == null));
			Thread.sleep(2000);
		}
		Thread.sleep(50000000);
	}
	
	public static final void start() throws Exception {
		DataKernelServerService launcher = new DataKernelServerService();
		DummyThnread dummyThnread = new DummyThnread();
		reference = new WeakReference<DataKernelServerService>(launcher);
		dummyReference = new WeakReference<DummyThnread>(dummyThnread);
		new Thread(() -> {
			try {
				launcher.launch(new String[0]);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}).start();
		dummyThnread.start();
	}
	
	public static final void stop() {
		reference.get().shutdown();
	}
}

public class DummyThnread extends Thread {

	private int i = 0;

	public void run() {
		System.out.println("running dummy : " + i);
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	
	@SuppressWarnings("deprecation")
	@Override
	public void finalize() throws Throwable {
		System.err.println("DummyThnread : finalized");
		super.finalize();
	}
}
public abstract class HttpServerLauncher extends Launcher {

	public static final String PROPERTIES_FILE      = "http-server.properties";
	public static final String BUSINESS_MODULE_PROP = "businessLogicModule";

	@Inject protected PrimaryServer primaryServer;

	@Provides
	protected final Eventloop primaryEventloop(Config config) {
		return Eventloop.create().initialize(ofEventloop(config.getChild("eventloop.primary")));
	}

	@Provides
	@Worker
	protected final Eventloop workerEventloop(Config config, @Optional ThrottlingController throttlingController) {
		return Eventloop.create().initialize(ofEventloop(config.getChild("eventloop.worker")))
				.initialize(eventloop -> eventloop.withInspector(throttlingController));
	}

	@Provides
	protected final WorkerPool workerPool(WorkerPools workerPools, Config config) {
		return workerPools.createPool(config.get(ofInteger(), "workers", 4));
	}

	@Provides
	protected final PrimaryServer primaryServer(Eventloop primaryEventloop, WorkerPool.Instances<AsyncHttpServer> workerServers, Config config) {
		return PrimaryServer.create(primaryEventloop, workerServers.getList()).initialize(ofPrimaryServer(config.getChild("http")));
	}

	@Provides
	@Worker
	protected final AsyncHttpServer workerServer(Eventloop eventloop, AsyncServlet servlet, Config config) {
		return AsyncHttpServer.create(eventloop, servlet).initialize(ofHttpWorker(config.getChild("http")));
	}

	@Override
	protected final Module getModule() {
		return combine(ServiceGraphModule.create(), WorkerPoolModule.create(), JmxModule.create().initialize(ofGlobalEventloopStats()),
				ConfigModule.create().printEffectiveConfig().rebindImport(new Key<CompletionStage<Void>>() {
				}, new Key<CompletionStage<Void>>(OnStart.class) {
				}), getBusinessLogicModule());
	}

	protected Module getBusinessLogicModule() {
		return Module.empty();
	}
}
public final class DataKernelServerService extends HttpServerLauncher  {

	public static final int WORKERS = 4;

	public DataKernelServerService() {
	}

	@Override
	public void run() throws Exception {
		logger.info("HTTP Server is listening on " + Stream.concat(
				primaryServer.getListenAddresses().stream().map(address -> "http://" + ("0.0.0.0".equals(address.getHostName()) ? "localhost" : address.getHostName()) + (address.getPort() != 80 ? ":" + address.getPort() : "") + "/"),
				primaryServer.getSslListenAddresses().stream().map(address -> "https://" + ("0.0.0.0".equals(address.getHostName()) ? "localhost" : address.getHostName()) + (address.getPort() != 80 ? ":" + address.getPort() : "") + "/"))
				.collect(joining(" ")));
		awaitShutdown();
	}
	
	@Provides
	public final AsyncServlet servlet() {
		return RoutingServlet.create().map("/do", request -> HttpResponse.ofCode(200).withPlainText("called"));
	}
	
	
	@Provides
	protected final Config config() {
		return Config.create()
				.with("http.listenAddresses", Config.ofValue(ofInetSocketAddress(), new InetSocketAddress(8080)))
				.with("workers", "" + WORKERS);
	}
	
	@SuppressWarnings("deprecation")
	@Override
	public void finalize() throws Throwable {
		System.err.println("DataKernelServerService : finalized");
		super.finalize();
	}
}



Sample Output :

datakernel garbage collected : false
dummy garbage collected : false
running dummy : 0
DummyThnread : finalized
datakernel garbage collected : false
dummy garbage collected : true
datakernel garbage collected : false
dummy garbage collected : true

codegen: ExpressionToString NullPointerException

The generated code of the ExpressionToString class produces a NullPointerException at runtime if one of the appended objects is null. I think it would be better to check for null and append the String "null" to the underlying StringBuilder.

In my case, I was creating a new class containing non-primitive type fields, those fields will got initialized with null and caused my toString method to throw a NullPointerException.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.