All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.zalando.sprocwrapper.sharding.VirtualShardIdentityStrategy Maven / Gradle / Ivy

Go to download

Library to make PostgreSQL stored procedures available through simple Java "*SProcService" interfaces including automatic object serialization and deserialization (using typemapper and convention-over-configuration). Supports sharding, advisory locking, statement timeouts and PostgreSQL types such as enums and hstore.

There is a newer version: 2.0.0
Show newest version
package de.zalando.sprocwrapper.sharding;

/**
 * simple strategy were the shard key is returned unmodified as integer. (this allows for "@ShardKey int shardIndex"
 * pseudo parameters)
 *
 * @author  hjacobs
 */
public class VirtualShardIdentityStrategy extends VirtualShardKeyStrategy {

    /**
     * @param   objs  Key Objects
     *
     * @return  virtual shard id
     */
    @Override
    public int getShardId(final Object[] objs) {
        return (Integer) objs[0];
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy