分布式 Java 服务平台 Baratine

Baratine 是新的分布式,基于内存的 Java 服务平台,可以构建高性能的 Web 服务,在同一个 JVM 中结合数据和逻辑。在 Baratine 中,数据和服务是一体的,服务拥有它自己的数据:

  1. 数据不属于数据库

  2. 数据不能被其他的进程修改 

  3. 数据不是独立于服务的 

=> 数据跟服务处于同一个 JVM,同一个线程,同一个类实例。

Baratine 远远不止于 NoSQL,Baratine 是 NoDB.。 

Baratine 包含的组件:

  • Inbox: ring-buffer queue

  • Journal

  • Distributed SQL-compatible database

  • BFS (Baratine File System): distributed file system

  • Bartender: cloud manager with heartbeats

  • Horizontal scaling with automatic partitioning

  • Web server

POJO 类:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@ResourceService("/counter/{_id}")
public class CounterService
{
  private long _id;
  private long _count;
 
  public long get()
  {
    return _count;
  }
 
  @Modify
  public long incrementAndGet()
  {
    return ++_count;
  }
 
  @Modify
  public long decrementAndGet()
  {
    return --_count;
  }
 
  @Modify
  public long addAndGet(long value)
  {
    _count += value;
 
    return _count;
  }
}

 

posted on 2016-02-25 10:38  荣锋亮  阅读(324)  评论(0编辑  收藏  举报

导航