Multiverse Parent Project

A Software Transactional Memory implementation for the JVM.

Группа

Группа

org.multiverse
Идентификатор

Идентификатор

multiverse
Последняя версия

Последняя версия

0.7.0
Дата

Дата

Тип

Тип

pom
Описание

Описание

Multiverse Parent Project
A Software Transactional Memory implementation for the JVM.
Система контроля версий

Система контроля версий

http://github.com/pveentjer/Multiverse

Скачать multiverse

Имя Файла Размер
multiverse-0.7.0.pom 2 KB
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.multiverse/multiverse/ -->
<dependency>
    <groupId>org.multiverse</groupId>
    <artifactId>multiverse</artifactId>
    <version>0.7.0</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/org.multiverse/multiverse/
implementation 'org.multiverse:multiverse:0.7.0'
// https://jarcasting.com/artifacts/org.multiverse/multiverse/
implementation ("org.multiverse:multiverse:0.7.0")
'org.multiverse:multiverse:pom:0.7.0'
<dependency org="org.multiverse" name="multiverse" rev="0.7.0">
  <artifact name="multiverse" type="pom" />
</dependency>
@Grapes(
@Grab(group='org.multiverse', module='multiverse', version='0.7.0')
)
libraryDependencies += "org.multiverse" % "multiverse" % "0.7.0"
[org.multiverse/multiverse "0.7.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

  • multiverse-core

Multiverse Software Transactional Memory

A software transactional memory implementation for the JVM. Access (read and writes) to shared memory is done through transactional references, that can be compared to the AtomicReferences of Java. Access to these references will be done under A (atomicity), C (consistency), I (isolation) semantics. For more information see multiverse.codehaus.org

Example

import org.multiverse.api.references.*;
import static org.multiverse.api.StmUtils.*;

public class Account{
    private final TxnRef<Date> lastModified = new TxnRef();
    private final TxnLong amount = new TxnLong();

    public Account(long amount){
       this.amount.set(amount);
       this.lastModified.set(new Date());
    }

    public Date getLastModifiedDate(){
        return lastModified.get();
    }

    public long getAmount(){
        return amount.get();
    }

    public static void transfer(final Account from, final Account to, final long amount){
        atomic(new Runnable()){
            public void run(){
                Date date = new Date();

                from.lastModified.set(date);
                from.amount.dec(amount);

                to.lastModified.set(date);
                to.amount.inc(amount);
            }
        }
    }
}

# And it can be called like this:

Account account1 = new Account(10);
Account account2 = new Account(20)
Account.transfer(account1, account2, 5);

No instrumentation.

Multiverse doesn't rely on instrumentation, so is easy to integrate in existing projects.

Версии библиотеки

Версия
0.7.0
0.7-RC-1
0.6.2
0.6.1
0.6
0.5.2
0.5
0.4.1-SNAPSHOPT
0.4
0.3