Resource Locking :: Sample

Parent pom providing dependency and plugin management for applications built with Maven

License

License

GroupId

GroupId

org.zalando
ArtifactId

ArtifactId

resource-locking-sample
Last Version

Last Version

1.3
Release Date

Release Date

Type

Type

jar
Description

Description

Resource Locking :: Sample
Parent pom providing dependency and plugin management for applications built with Maven
Project Organization

Project Organization

Zalando SE

Download resource-locking-sample

How to add to project

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

Dependencies

compile (5)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-web jar 1.5.2.RELEASE
org.springframework.boot : spring-boot-starter-jdbc jar 1.5.2.RELEASE
org.zalando : zalando-boot-etcd-starter jar 2.3
org.zalando : resource-locking-starter jar 1.3
org.postgresql : postgresql jar 9.4.1212.jre7

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.16.14

test (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-test jar 1.5.2.RELEASE

Project Modules

There are no modules declared in this project.

resource-locking

Maven Central Build Status

Purpose

The resource-locking library provides a service that does pessimistic locking of a resource using different backends. You can use this library to synchronize running jobs over different instances or do pessimistic locking for the same resource over different instances.

Features

  • resource-locking with etcd as backend
  • resource-locking with JDBC as backend and access via SQL statements
  • resource-locking with JDBC as backend and access via SQL stored procedures

Usage

Use the provided Spring Boot Starter library and either.

<dependency>
  <groupId>org.zalando</groupId>
  <artifactId>resource-locking-starter</artifactId>
  <version>RELEASE</version>
</dependency>

etcd

If you want to use etcd backend include the following dependency that provides the etcd client:

<dependency>
  <groupId>org.zalando</groupId>
  <artifactId>zalando-boot-etcd</artifactId>
  <version>2.3</version>
</dependency>

Additionally write a configuration that provides the specific backend for resource locking.

@Configuration()
public class ResourceLockManagerConfiguration {
   
    @Bean
    public ResourceLockManager resourceLockManager(EtcdClient etcdClient) {
        return new ResourceLockManagerEtcdImpl(etcdClient, "resource-locking-sample");
    }
}

jdbc

If you want to use jdbc backend include the following dependency that provides the etcd client:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>

Additionally write a configuration that provides the specific backend for resource locking.

@Configuration()
public class ResourceLockManagerConfiguration {
    
    @Bean
    public ResourceLockManager resourceLockManager(JdbcTemplate template) {
        return new ResourceLockManagerJdbcImpl(template);
        // OR: return new ResourceLockManagerJdbcFunctionImpl(template);
    }
}

Development

Building

mvn clean install

Releasing

mvn release:prepare release:perform

Contributions

This project accepts contributions from the open-source community, including bug fixes and feature adds.

Before making a contribution, please let us know by posting a comment to the relevant issue. And if you would like to propose a new feature, do start a new issue explaining the feature you’d like to contribute.

License

The MIT License (MIT)

Copyright (c) 2017 Zalando SE, https://tech.zalando.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

org.zalando

The Zalando Incubator

Projects in development at Zalando. We accept contributions and feedback—leave an issue at the relevant project's issues tracker.

Versions

Version
1.3
1.2