This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean id="myFunction" class="AdjustPriceSqlFunction" /> | |
<os-core:embedded-space id="space" name="mySpace"> | |
<os-core:space-sql-function name="ADJUSTED_PRICE"> | |
<os-core:sql-function ref="myFunction" /> | |
</os-core:space-sql-function> | |
</os-core:embedded-space> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AdjustPriceSqlFunction extends SqlFunction { | |
@Override | |
public Object apply(SqlFunctionExecutionContext context) { | |
// Add 20% | |
return (Double)context.getArgument(0) * 1.2; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start two GSCs, two global GSMs and two global LUSs and a ZooKeeper | |
gs-agent gsa.gsc 2 gsa.global.gsm 2 gsa.global.lus 2 gsa.zk 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A SQL query with a user-defined function ADJUSTED_PRICE | |
// which will return all the stock prices with an adjusted price = 23.2 | |
query = new SQLQuery<Stock>(Stock.class, "ADJUSTED_PRICE(price) = ?", 23.2); | |
IntValue[] values = gigaSpace.readMultiple(query); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:os-core="http://www.openspaces.org/schema/core" | |
xmlns:blob-store="http://www.openspaces.org/schema/rocksdb-blob-store" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd | |
http://www.openspaces.org/schema/core http://www.openspaces.org/schema/11.0/core/openspaces-core.xsd | |
http://www.openspaces.org/schema/rocksdb-blob-store http://www.openspaces.org/schema/11.0/rocksdb-blob-store/openspaces-rocksdb-blobstore.xsd"> | |
<blob-store:rocksdb-blob-store id="myBlobStore" paths="[/mnt/db1,/mnt/db2]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.openspaces.spatial.shapes.Point; | |
public class GasStation { | |
private Point location; | |
@SpaceSpatialIndex | |
public Point getLocation() { | |
return location; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public GasStation findNearbyGasStation(Point location, int radius) { | |
SQLQuery<GasStation> query = new SQLQuery(GasStation.class, "location spatial:within ?") | |
.setParameter(1, ShapeFactory.circle(location, radius)); | |
return gigaSpace.read(query); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.openspaces.admin.* | |
import org.openspaces.admin.pu.elastic.config.ManualCapacityScaleConfigurer | |
import org.openspaces.admin.space.ElasticSpaceDeployment | |
import org.openspaces.core.util.MemoryUnit | |
println "Starting Elastic In-Memory Data Grid..." | |
pu = new AdminFactory().addGroup("ahodroj").createAdmin().gridServiceManagers.waitForAtLeastOne().deploy( | |
new ElasticSpaceDeployment("mySpace") | |
.memoryCapacityPerContainer(128, MemoryUnit.MEGABYTES).maxMemoryCapacity(2048, MemoryUnit.MEGABYTES) | |
.singleMachineDeployment() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end('Hello World from Node\n'); | |
}).listen(3383); | |
console.log('Server running at http://127.0.0.1:3383/'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object/2 | |
invoke/3 | |
::/2 | |
get_property/3 | |
set_property/3 |
NewerOlder