Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. String id_tile;
  2. int zoomLvl;
  3. int x;
  4. int y;
  5. byte[] imageInByte;
  6. String id_photo;
  7. DataLoader dat = new DataLoader();
  8.  
  9. private boolean available = false;
  10.  
  11. public synchronized void get() throws IOException, SQLException {
  12.  
  13. while (available == false) {
  14. try {
  15. wait();
  16. } catch (InterruptedException e) {
  17. }
  18. }
  19. // метод, который записывает в БД (должен записывать)
  20. dat.insertToTiles(id_tile, zoomLvl, x, y, imageInByte, id_photo);
  21.  
  22. available = false;
  23. notifyAll();
  24. }
  25.  
  26. public synchronized void put(String id_tile, int zoomLvl, int i, int j, byte[] imageInByte, String id_photo)
  27. throws IOException {
  28. while (available == true) {
  29. try {
  30. wait();
  31. } catch (InterruptedException e) {
  32. }
  33. }
  34.  
  35. this.id_tile = id_tile;
  36. this.zoomLvl = zoomLvl;
  37. this.x = i;
  38. this.y = j;
  39. this.id_photo = id_photo;
  40. this.imageInByte = imageInByte;
  41.  
  42. available = true;
  43. notifyAll();
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement