Skip to content

Instantly share code, notes, and snippets.

CREATE TABLE user_properties(
id BIGINT NOT NULL AUTO_INCREMENT,
legacy_user_id BIGINT NOT NULL,
vevo_user_id VARCHAR(22) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
property_type VARCHAR(255) NOT NULL,
created DATETIME DEFAULT CURRENT_TIMESTAMP,
modified DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY property_type_unique (vevo_user_id, property_type),
PRIMARY KEY(id),
FOREIGN KEY(vevo_user_id) REFERENCES id_generation(vevo_user_id),
------------------------
LATEST DETECTED DEADLOCK
------------------------
2016-06-22 19:26:01 2af7ba087700
*** (1) TRANSACTION:
TRANSACTION 264153653, ACTIVE 0 sec inserting
mysql tables in use 1, locked 1
LOCK WAIT 12 lock struct(s), heap size 376, 13 row lock(s), undo log entries 3
MySQL thread id 1697, OS thread handle 0x2af7a5706700, query id 988361715 10.11.55.253 ripple update
INSERT INTO user_properties (id, legacy_user_id, vevo_user_id, property_type) VALUES (NULL, 26713336, 'yv5yaEZL31q2TtGqa05XSg', 'BIRTHDAY')
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
### The error may involve com.vevo.ripple.storage.mapper.UserPropertyMapper.createPropertyKey-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO user_properties (id, legacy_user_id, vevo_user_id, property_type) VALUES (NULL, ?, ?, ?)
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) ~[ripple-1.0-SNAPSHOT-all.jar:na]
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:172) ~[ripple-1.0-SNAPSHOT-all.jar:na]
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:157) ~[ripple-1.0-SNAPSHOT-all.jar:na]
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:52)
String[] dateOfBirthList = dateOfBirth.split("T00:00:00Z");
dateOfBirth = dateOfBirthList[0];
if (dateOfBirth.length() == 10) {
dateOfBirthList = dateOfBirth.split("-");
String year = dateOfBirthList[0];
String month = dateOfBirthList[1];
String day = dateOfBirthList[2];
public void getForageForRoom(Room room, Player player) {
int countOfForagesFound = 0;
int totalForageXp = 0;
try {
for (Forage forage : room.getForages().values()) {
int foragingLevel = getLevel(gameManager.getPlayerManager().getPlayerMetadata(player.getPlayerId()).getStats().getForaging());
if (forage.getMinLevel() > foragingLevel) {
// System.out.println("Foraging level not high enough.");
return;
{
"name": "street hustler",
"colorName": "street hustler",
"dieMessage": "street hustler dies in a pool of blood",
"loot": {
"lootGoldMin": 34,
"lootGoldMax": 55,
"lootItems": [
2
]
{
"colorName": "COLORNAME",
"dieMessage": "DIEMESSAGE",
"name": "NAME",
"loot": {
"lootGoldMin": 5,
"lootGoldMax": 10,
"lootItems": []
},
"roamAreas": [
level: 1 is 40000exp.
level: 2 is 160000exp.
level: 3 is 360000exp.
level: 4 is 640000exp.
level: 5 is 1000000exp.
level: 6 is 1440000exp.
level: 7 is 1960000exp.
level: 8 is 2560000exp.
level: 9 is 3240000exp.
level: 10 is 4000000exp.
public static int getLevel(int experience) {
double constant = 0.032;
double v = constant * sqrt(experience);
return (int) Math.floor(v);
}
startUpMessage("Adding Phantom Knights");
PhantomKnight phantomKnight = new PhantomKnight(gameManager, new Loot(18, 26, Sets.<Item>newHashSet()));
entityManager.addEntity(new NpcSpawner(phantomKnight, Sets.newHashSet(Area.BLOODRIDGE5_ZONE), gameManager, new SpawnRule(10, 6, 2, 100)));
entityManager.addEntity(new NpcSpawner(phantomKnight, Sets.newHashSet(Area.BLOODRIDGE6_ZONE), gameManager, new SpawnRule(10, 14, 2, 100)));
entityManager.addEntity(new NpcSpawner(phantomKnight, Sets.newHashSet(Area.BLOODRIDGE7_ZONE), gameManager, new SpawnRule(10, 14, 2, 100)));
PhantomOrc phantomOrc = new PhantomOrc(gameManager, new Loot(16, 24, Sets.<Item>newHashSet()));
startUpMessage("Adding Phantom Orcs");