Posts filed under ‘Java’
[CON6076] The Good Cop/Bad Cop Guide to Java 9 session subtitle
You’re 60 minutes but thank you.
And if you don’t like the presentation.
Very much like.
Yeah, it’s still a person.
I’ll say I said big turning up we love translate Java once exactly for the full room please please program session that will be also I will not, you know, that you also spoke in the guys told me. Yellow in the bed bugs don’t actually work. So.
You will release as they go few before but I think.
I think that it’s a fairly.
What is left two minutes left? So any questions. Any questions. Because a couple of people are starting to leave, let’s do not have work. So before there were a couple of people who are not excited by John 9 let’s try that again who’s excited about going that release.
Laughing little actually do the search for complete features, well pretty sure it does not, so, yeah. You can see you can pretty much search for whatever you want that it does a small search. So welcome to 3005 without one.
I’ll suck *** wrong side head type coming into that you can actually just pacifica peaceful future. For example, that you can just do up to seek up left.
Some teachers might be angry but that will save the best to last Html five yama docks, and it is reasonable you can type in now.
Orry mission libraries in relation did not make it look really good night, which is really great because we have plenty of third party information and you can choose whatever my country personally smart. I think that’s prayer.
Okay. So let’s jump ahead. Okay. So the final few things that will will talk about 82 18 18 82 is is an incubator project rather than being in in the full full game which is what i mentioned before. So I went to buy that for too long is your slide. I don’t know, why you picked this paycheck and said it’s a picture of Google storage angry keeps your and this was an easy course.
But we still super excited to live there for the API improvements.
With him this little line of the tri block if you can declare them somewhere above and then you some reference them into try with resources blocked and they will be closed automatically at the end of that try block so that. Means the cook much more readable, but it’s really hard to show him. So.
Yeah. If used trying with resources. This is fantastic. This is not the API increment language for the try with resources blocks. Now, you can use effective with final variables in the driver’s resources. So we don’t need to declare them.
In a gallon which opponents you can have private mess in the interface is so now we see the full methods it in private methods. You can actually put a lot of logic in your interfaces, which is amazingly great. And drug coupled other things.
An exception right now there is no type don’t know that there is no keyboard you work if I did just dude dude underscores just like Simon, I will have the name than the reasonable Vermeil’s typing friends sufficient enough and. Will do but you can easily keep works. So you going to keep your source code for the land of sports and then you can read that.
Unreasonable to type of thing like this what will happen if he click on her.
There’s exactly one method that sports act, but we can do that if you can find it. That’s recalled the single underscore is not supported. This is now.
Improvements my personal favorite is that now we can leave the property files in Utah 8.
You can get the arguments for any processes, you can get the process of representation in your Java code. So if you deal with some processes where if you need to check any ornaments. You can differentiate with within process is much easier. This is also cross platform which is fairly great. Because now everyone everything runs in doctor. So now we especially need that cross platform things.
Yeah.
In fall and get some arguments and he.
He can do this process management fairly easily. So you can get the current process. You can then execute some.
Process, hello.
Process handle if there is any class and you can do.
Taken three or whatever the version ends up being but with the process.
I should know this is just exactly like a four loop but now with you can generate a streams normally like, you would do because you have some conditions and from a sequence of value is a step back and it’s. Really interesting guy to play with some improvements for local digital timer. There are some improvements for the process handles the process process management is interesting because before it was so messy in Jonah number just show you that thing and then we’ll go to next time next things also concurrent improvements. Completely teacher got a couple of the methods the world’s racket classes in the flow. So we can get closer to the record programming median shady.
Proper lady would suggest me to do that.
See.
It’s not a way around.
And.
Frank.
You think that was that it right method where you can do the property eration, and i will need to check the syntax on that. So you start with the start value than you do the increment step and then you specify condition and before july 9 it was quite clumsy to do that because the worst known each right method to do that. But now we can do that. If it’s less than 10 and then we preach with print them.
You see we dropped the first five elements also we can just take the number of elements in from the stream. It’s very useful. If you just need five elements but not the five elements, but you need to take the vents until some condition is met. For example, you want to skip the duplicates events or something. So the stream a guy was enhanced as well. One thing I like that. It’s actually, it’s the type wall. So, for example, if you actually had an infinite stream want to continue running running you might say I’m going to take while while some other condition is met and then when something once on video, it’s true. Then you stop by infinistream they all need to kill a process to kill those traits. That’s quite a distance from.
Reach will ranks this element.
An ex 6 more than five and then after that we will.
I’m very rarely, I’m a bad hot. So the right couple of things on the stream ties with it did take it in stream. And if I will type that correctly, and then we’ll do a range from one to 10 now we have the methods to trouble amounts while and take while which are pretty interesting. They also present in all other stream conditions on now will have them built in the jig is one, so say we can drop the elements until a certain condition is matter.
Play optimistic person.
I love the way you love the way it took about four times to do that because you actually smiley instead of a court.
You can never know if it works not, why you because we’re in jail.
Okay, hopes works.
Yes tax, and if it’s not then we just have a supplier and we do print.
You start speaking.
I think we need this side effect here.
And it takes two functions soldiers present, then we have a function and we do.
Or else.
Sleep we had the method called present which would take a function which will evaluate only the evaluating awful is present. Now we can have the method that takes two arguments in it called it is called if present.
Do you want?
What is it?
Evaluate the function that provided if I do just the normal thing optional one, and it will do the map immediately here I will get the results immediately. So if you have a functions you might go mapping the functions which are expensive performance, wise any don’t may need really need to be about the merely your can always convert an optional stream very easily, and other people saying. That is present in the optional.
What will I get back we’ll get four will like it then optional 4 1 2 my masses terminal no? In fact, I will since stream is lazy by default. Now, if I convert optionally to stream. I will get the lateness of the stream in my optional, so that I will get the reference my plan will need to terminal operation to actually.
Apply a function when I get sick ax times two.
27 and i do a map function here. So I haven’t.
Swimming like, Nasa’s formatting functions or the values within the control panel container. It’s very important. So that right do this 27.
And I get to stream implication while it seems like a reasonable thing to do because in optional provides.
And then you remembered if you’re still in class fast and everything is rank. So besides that there a couple of things that. So in German 8 we got the stream ati and got optional some java and those are really great. And then in German 9 3 couple of improvements one of my hair it is a stream method on the optional. So what I can do now is optional off say one and I can do a stream of it.
If you don’t get more to let, you know, seeing you actually seem which module that came from which is kind of nice interesting thing to know about one here.
Yeah.
Smart. So in fact, I won’t get any new information that was just add it in the German 9 and it’s an immutable list of one element and one of the things is those implementations are fairly heavily optimized though that for example. Stores the element in the field. So we pass it but it doesn’t need to do that in the rate access. So we just read the element directly because it’s mytable inclination one element and so on, if you have any subduing limits. It’s also Hella way up to my eyes and there are collection of elements and further. So those collection literals will make it quick more readable, and it’s going to be absolutely great. Tutti soaps other interesting thing actually when you call that get close. But if you just grab that again of that get close you can actually do a dot, I think it is again module.
Few people who think I’ll get the link list.
A simplified the syntax also during for things big implementations of those classes are a 13 percent. So if I do this and you get the class what is it called again, who thinks I will get them the realist.
Implementation of the listen interface over you can do is set up and you just type off and you do the elements and you have a set you can also do a map where you will just provide the key and entry. Values in the robe and it will create a map that to you the good thing about this is while.
Just getting in the collection liros there. I think that’s because we’re talking about Java. So this thing it was again. Do you can talk about you can create the list of elements or a set of holiness in a single line of code and you populate that had it is a fully functional.
It’s not my machine. So my typing will be little bit slow. But we’ll manage if we run out of time please just tell me that we need to cover up things because the remaining media improvements in China right now. And we will not go through all of them. I’m showing you a couple of that I like the most war, I think there are mostly fluent influential. Maybe we’ll see how much will kind of do. So one thing that we wanted from Java 40 years and everyone thought that you speak absolutely great to have that work collection literals. So we don’t need to create the newer relate list. And then the subsequent statements publicly that was the data. Now we have those collections leaders in Java I fear.
This 50 50 make updates a week already about updates we gonna both be good cop free updates cause the api updates always pretty awesome job developers. So you gonna do *** it, right here and also have a little worse. Obviously, I’m going to show you the new economy using the situation hope. I don’t take that vote now.
Right?
And then draw and I think.
Stands out when you see.
All right.
Okay. Okay, here gives us a proper ideam hasn’t done Java development team to be on your emacs 40 just and then it will more i need support some sort of evaluation of expressions works scratch pad to something and the you know. That they will almost never touch the judicial at real job except for testing expo something.
Please Jay Cell is an interesting tool you use it to test out Apis and things without having to split up the whole browser in browser idea. There’s a whole bunch of extra things who likes the idea of just coding quick.
Special is it is a given all other languages have that now Java has as well.
So, yeah, I.
Kids commands within the context of that process eat as far as I know currently cannot do that. He can embed ratio and greatly to console in your app, but you have to think about that before hand and if you think about that before hand doesn’t count.
No reason you can presentation situation, but it just takes a little bit more typing. So while it’s a great thing it feels a little bit gimmicky. Personally, I would love to see the future where you can connect your gee shelter running qadian process Java process.
A man and usually pretty meeting at the same time, it’s really hard to imagine that usual would change the way we develop software. It’s pretty hard to type in a significantly large program interesting was shown there is a reason why Simon show you how to create an annotation.
Joe is gonna change it we help people learn Java until people get into the using Java especially the small humans.
System out print stuff things like that. One thing I will say which is absolutely also and it’s better marks in remote 6 on say it all set so much in him. She said it before hide composed in really great videos at state minutes longer. So I want you did was she created a script with a with a hatchback and passing it shell and you can never scripts and with some Java code and by doing that you catch me execute Jay Shell as if you. Were like a basket or something like that. If frozen exceptional benefit still does that maybe frozen section but you can ignore that I’m just going to run Java like a script how calls that but that’s joke shop brilliant brilliant, and it’s used for A.. Bad cop we.
Hello? Hello.
If you if you talk to a cell and you just like printing something that was very, very nice, that we get but my key and that will actually does is it per type look at the methods of provide with A. Whole list of print. So I can then type abstract type print.
There we go.
So.
Text file and now is run everything. So you saw that one second better late than you saw the integration of everything that you see how well that’s Jay Soldiers pretty awesome. One other thing actually if I slashed exit. This is only use about Caroline here depending on how happy are feeling at the time you can exit in two different ways. You can either commande if you’re feeling like I don’t really want anyone to talk to you if you think of it down if you think down you need some need a hug touch like sex and it’s goodbye.
Yeah, I’ll things like you can check what’s imported other things if I wanted to I can just type a list and I can see everything that I’ve typed in two Janie Kay, I can also type to slash. History and I get everything outside when it’s in the Johnny Cake or to the console itself, and i wanted to I can save that as come-ons, I can slash research which resets my states are fine art type slash. Feel I get nothing but what I can do is I can open come on to this she just saving it as a.
We get holly. Well, so I can do that we can also add classes and things like I wanted to work. So I could just so I can say a class by we got close. I could say interface conserved face big we can interface I can type slash team we got type. So, it’s pretty much just know busing using a rep who used to wrap up before fraught with other languages just get this great. We can use with them as I think Java Revel dot com was what we could use previously but this is nicely collected straight into the Johnny Cake.
And from him, I can say hello world, I can say except that you’ll notice that that’s actually updated. Now I can exit I can execute that Paula. Jeez for making that I.
Say, hello. And we get some amazing 1970 window pop up.
It’s a hotel I checked it out.
Hello. At this point cause I’m doing multi lines it obviously needs a obviously into semi colon. So when I do that we now have a method. So I can type slash 10 and we get a better. I can slash editor.
I’m done here I can just do something like system out of print print, then.
If I do a public voice. I love low.
Catch how cool is that.
Yeah, I swear threat to sleep.
Let me kind of week we can coach other without semi colon tell kids that it’s amazing. That’s what the word but nothing else went away for just a movie.
Tell me what’s missing there. Let me just put that at the top was missing there.
And that gives me that you speak the variables that we’ve got a if I wanted to do something interesting like system.
It was three and you get five. So now it’s double up the school that how cool is pretty that you’ve left out in force i types last fee.
Right. So that means what console here. I’m in a console I can talk to Jay Dickey, I can talk to other shell if I wanted to talk to Johnny Cake. I just put something as simple as one plus two and I guess me three if I wanted to talk to the shell spinning slash as soon as I put a slash on the talking to Jenny case, we have a number. Of things I can do. So one of the other thing I’ll mention there is when I put one plus two. I didn’t actually assign it to a variable. So what is actually done decided to a variable forming the dollar one if I wanted to do something similar like int ex equally notable underscore upper double underscores Icab double underscore equals two plus three ships two plus three. I know. It’s not right now just walked in that’s why did that.
Usually not going to repel it’s a rabble. So I just talked a shell that puts me to really nice condos. That is not readable for back.
Second.
Okay.
Translator we got redevelopment look let’s just meet with them.
Really love program close.
You can leave you guys cook up it, right? So you sell a cell is a replica stands for?
As a gimmick.
Okay, let’s stop.
Glasses, I’m good copy.
Right? Okay.
Shell.
But even, okay, right. Next one if you know, I’m not would you do that shell everyone loves to show.
Believes it is a good it leaves it is a really good thing.
It would be no different in Eastern Europe.
Okay, this might be close though.
Tested in supported in China case 7 that was before my five year old son was born officially the default you see in jenny canine who cares you can use it anytime you wanted before jackie canine just with this switch and if. You are using a specific gee see in your jovian arguments can affect you because you’re going to continue to use that in Tianjin Canine. So gee one gessi a good thing, probably is it gives you choice is a good enjoy conjecture canine when it’s getting Jenny Canine is a good it is 8 7 and 6 it’s always been there pretty much so that’s why. Argument as to why do you want easy isn’t a big deal in any canine remain as a result. It’s not a big deal in Janie Kay 9.
So to summarize that you get the faster memory management. We spear application tricks. Is she want to see a good thing. Well, some forms experts say, yes, something textbooks. So, ultimately it really depends on your application, you need to test it with your application. But the question is gee one gessi exciting Indian Java 9 well let me actually go back to a couple of things this was introduced in chinese came 6 hours before my five year old son was born.
I think the next thing is yours.
Yeah. This is how it came to us, it was introducing gdp 6 it was tested so it’s a very much your technology. You could have used at least work very many companies try that tested that don’t different work clothes and it works beautifully and now it is getting through all of us in jail ignites when you run your applications on online. They will probably run a little bit faster in terms of having smaller garbage collection process in the US trade off some throughput maximal stupid because the government you want to see will run concurrently with the application. So not the full resources for hardware will be available to you but for most applications especially for applications where the latency is important. This is a very great pain.
Do you want to see is pretty amazing in?
In a normal conversation we can stop at that.
And this is all garbage collection tuning that is required for which do you want to see, well, there were force more to that but.
Removed all the time. But the main benefit of that is that the garbage collection can decide how many of those small regions, it can collect at any given moment and through that it can control what is your work coverage collection thoughts was that he. Can do this is a things first key the latest in the garbage collection goes down second you can adapt if Lee control data. So you don’t have to have a stretch sheet of gave him options to Kenya garbage collection. In fact teaching your garbage collection. Now, what you want to do you want to just say this is my requirements for the conversation flows this. And this is my record how much space I can sacrifice to achieve that.
So now she want to see this concept is pushed into not to the extreme but much further what do you want to see that it splits your keep into very small regions, and then the only allocated and objects are. Located in them randomly you still have the type sold in some of them will be young objects in some of them will be although tricks.
Michael Speak probably will survive more. So it doesn’t make sense to collect the memory from the cold space. But it’s better to sleep that into different regions. And then you can perform smaller numbers collections and safe time on that. So delete and see if single garbage collection cycle, Google down.
What else? Let’s talk about the future. So let’s look at the garbage collection between because this is something that does make some a great and from the beginning of the times we had to manage memory, and we all use application resource the hardware resource in. Memory as it is infinite and it is absolutely perfect, so what comes in John 9 it comes a new default garbage collectors called do you want to see if you think of the java keep john memory you probably think of a. Picture something like this. You have the heap just separated in different regions the reserve even space where the new objects are located and then when they leave long enough if their survivors begin promoted to the care of space. And then they become the old generation the hypothesis is here is very simple although tricks that already survived the couple of Jesus.
How are you?
But that is the answer is no further though. Let’s start all I would not want right.
But that’s not that’s not the question.
I think that.
The German I release and migration will not be easy.
There we go.
It takes that much about the save the Java language and is has actually made the Java language most stable for the future who believes that much loud. He is a good thing it job 9.
Who thinks?
So much market, let’s vote.
This feature like modules will benefit architecture concerns vary greatly. But for developer it could be a lot of pain, so the good thing is done safely still iaccessible. So we can do stuff on the covers.
Out of those two people think is in developer and who is an architect.
Find out you can benefit from the other improvements that are in China and then you want to fix the easiest things that you can potentially fix concerning the module system currently it is not enforced it to the very strictest level. By default but you can turn it on if you want to if you wanted to work fixing those errors but you can fix the warnings and then you wait for some time preferably somewhere until April 2018 first you will have any. Major release of Java and second probably their system will catch up and you can migrate to modules bottoms up starting from the libraries, you can also migrate the other way around but it’s much harder. So when you think about the modules keep this picture in mind.
Several thousand files big, then you would perhaps have a problem, you would have a problem with the bill systems you will have a problem with ecosystem where some libraries don’t actually migrate werkbund supported or maintaining each other and all. That can cause you trouble. So when you weren’t getting excited about the modules you have to know that there was a migration pass. So before the migration path was a little bit unclear up to the very last moment of the really switch online currently we think that this is the idea how to migrate further. What do you want to do you don’t want to have pretty development environment immediately starts portugal rising everything you want to do you want to unreleased you cannot have read your production environment out of the blue because that’s? Just unwind. So we want to unbreak your staging environment or something where you can.
And so Michael Sauce really nice problem of the open geki and enforcing the rules and then reveals the opportunity better. But what does it cost because her single on the language levels that are this is like five new keywords and you model info file and a lot of pain with actually migrating old projects to the John 9 if you work in? The Greenfield projects you start from scratch. This is amazing and you would love it if you actually have an application that is several gigabytes.
Some of us didn’t choose that.
Excellent your good people.
That’s pretty amazing modules or excellent as someone said, we have a smaller footprint. We have class release cadence which has nothing to do with modules. But the features we can get it the sooner. So before we go forward we need to assess every feature love just fight with it gives us or what other people say that gives us, but what it actually doesn’t solve the problem for us and we have to remember that. Modules built in the Jay Dickey as lead our were designed to solve the problems were the Jay Dickey developers it wasn’t it wasn’t implanted device emotional or system to gild consumer applications from scratch. We had nothing particular to have joy in our systems. We didn’t choose that most of us didn’t choose that please with giant.
That’s good.
And so actually play with Java with a beta. So I think we should just vote now and again, there’s a bad cop in here as well.
I also will talk a little bit about Http two later, but it wasn’t ready because we needed more community feedback but now we can do speak release a module as an incubator which will allow for that community feedback and I. Later stage we push into the main over Judy Cake. So not only is going to provide us with a much nicer way of developing a code, but he’s also allowed us with all these new freedoms to release Java quicker to have smaller run times.
Into the percent of the new runtime with it. You know, in a single module without having too many dependencies on other modules, we can also use a tool called Jailing which allows us to reduce the size of our run type using jailing we can say this is my application. Provide me with a Java image that will allow you to only use platform modules you need and it will provide you with a 14 mega image rather than this huge image. And that will allow you to run the day, you know the Javy me with your application and it’s much much faster smaller footprint.
For 12 hours to have more traffic ations but be cause of the module system. I’m sure all of you have heard of the new release cadence in Java going forward is going to be every 6 months. So next March are going to have was likely to be called in 18 93 release their next september 11 18 9 release the reason this is possible with cause of the module system by having by having everything’s modules is much much easier to. Make her updates.
Stopping on modules a full week. I don’t want to say the modules hasn’t just been available there.
Wait.
Well.
So that’s modules.
I’ve got from.
Get name. It’s say, let’s realized that I can get the name of the class, which is.
And let’s say let’s say this is from a plus this class.
Provide input. So, I’m going to provide the service and here is our implementation. And what is going to do when I say that and after 9 that’s going to reload in and all of a sudden we’re getting a service backup services just returning underscore what that simple provides measures does is that. The Java runtime is under the covers registering that service with the service load up and then when we actually used that by another month. She’ll actually perform a look up into our service loader were grabbing that service back and just to prove, that is the service I can go into our provider amplify wanted to.
Around dogs API dog my service, I’m going to provide that it’s going to provide that with people dog zero turn around dots provider.
I just got rid of that.
And then we got three loaded, but we still not getting anything back and that’s because no services have been registered at the way to register a service is in my provider class maybe go provide a simple we have our. Provider input which I showed you in our model in Photo Java what we actually need to say is we need to say what we’re going to provide the class org dot zero to.
Element via on coding you get far fewer bugs as amazing as in a way more people don’t do it so we go to the service loader we say the load all services of the interface my service we have to get. In trouble back of my services we go through that. And we just try and call get message on that. So I’m going to hit save on the reload that into my runtime.
Every guys that’s been reloaded live into the environment still not get any service is no one of the reasons for that is but we’re not actually grabbing any services from the service load up. So I’m going to come back in here. I’m going to uncomment this is a great way of this great new style of development is called.
As general loading. I’m now here we have a loop looking for services, but there’s no services there, how do we actually use services or we use it by the service load up service later is actually something which was what 1 6 1 4 something and. It’s been there and the majority system uses the same service load that we can register things with it. And we can grab some grub services from there. So what I do is first of all, I’m going to actually make sure we’re using the service loader. So in our consumer module wanna say here is on the say that we use a specific service. That’s going to be all dark zero turn out round the API dot my service to now saying that we’re going to be using that service Oregon. It’s safe to rebuild my application.
I will apply dribble does is provide input implements my service and implements they get message did it go. So we have a provider which implements the service we have a consumer which will soon grab that service. That’s pretty much. So I’m going to run this so much in already using general. So we will get a code and updated as we go.
Next thing is the provider import.
I can see my just has a main method it got it spins round a loop calling cool services call service is just as a system print out a of a counter looking to services that counted incremented we sleep for A.. Second and then we print out nothing. It’s also it does pretty much nothing yet. But there’s a little spoiler for you in the middle which we won’t talk about just yet.
Sorry. I can see my head has a single class called consumer. Wow. That’s not really a smoke break it is a.
Our consumer was a consumer here.
Right. I *** I is very simple. It’s got my service and it just has a single method called get message and our modular photo Java we just export that package. So this is a module containing code that is been exposed to the rest of the module system.
Is.
That actually goes to the provider via an API. Now I apply for just quickly have a look at that.
Some of this up. So intelligent right now I have three modules three Jane. Modules, I have also zero turn on the 80 i start with consumers are consumer.
Coffee people cash also up, so you have a demo just with services something to ever too intelligent.
You probably already seen how to help job don’t send not set up.
Just so *** it Josh.
As a result the unsafe. I see I which many of you heard of mostly property frameworks and libraries the unsafe API is going to be in from you it was an API which was which was meant to be an internal API as i said. Before there is no enforcement previously. So people were using it and actually for good reason because it’s great stuff in there, and it’s made our ecosystem richer.
Wow, that is painful does not.
So much we can use what the module depends on what it requires, that’s that created module graph. So if a client applications running the class part is still running on a modular Javy Am, but if you choose to use the module partner application then both you old platform and your application will be running in a modular way. But you don’t necessarily need to do both.
Platform will always enforce tea. We can’t compile again, something if I’m module structure to determines that we don’t actually depend on that module. Likewise. Now runtime we can’t start our runtime unless all the modules are present for the application to run. So very keep both incomm population. I’m during runtime the module structure must be satisfied rust converter fully compile awfully run as very important. But this is the first time with hard enforcement now. Yes, we had the module path we still have the class pala. So if you wanted store use the class while you can, well though under the covers everything is still modular in the platform. So you can’t use things that are hidden from you. So what’s in front you, well in modules, you have a calculation what the module exports is what I.
And the reason is up till now we haven’t had any enforcement in our runtime now whether we’re compiling or whether we actually burning in the wrong time.
Okay. We deal with much about it, you already when we just don’t think we drop boxes we write words in the box is in control arrows between them we design in a modular way. So when we write code we write it very flat again. We don’t actually put like push that into a modularity.
Build up this dependency tree.
Quar certain module. Let’s say we have a scripting that module will in turn depend on basic depending on which modules, you require.
At the bottom here we have been the job base classes. This is the fundamental class which every application and everything must use it contains things like collections everything that you need to use if you want to any kind of job application. We also have some compact profiles there which you may recognize from other things the lines are dependencies. So if you require a specific a bundle as white module. And when I was joined persons, well, so this is hearts.
You’ll notice.
We don’t cool. But why do we have to have it because we have to support really old upset need Corba, okay. But even if we don’t want to use call, but we have to still have it as possible, so what we do is we marginalize the platform into modules that we can choose whether we want to have in our own. Time or not and depending on what I like Asian needs from it’s from his platform we can bundle up a new runtime which only provides that. So we’re creating a runtime based on the needs of our application rather than having this one size fits all Jovem, and it is a big size fits all de Vienne for any application that wants to run on that job. Platform.
No weeping.
Elephant in the room big elephant in the room much after why do we need modularity. Well, we have much loud in a couple of different ways. We have platform agile our team we have application which are we really need that for much larger because the way the, the platform is gone over many many years requiring backwards compatibility, it’s turned into really the elephant in. Room, right. It’s a huge beast that we need to support horrible things like all of a school bus.
Right? So let’s start.
Okay, good.
We might have a guest or somewhere welcome poll quiz not excited about John night than this kind of disappointed with this release.
If you do that is studia that would never have never?
I’m just taking all I like really that’s probably what I’ll say sorry start before we start, let’s not get into this debate. So fast who’s excited? So German 9 was cooking for a long time and then it was released and people some people are excited about that some people are not that excited about that. So let’s vote in the beginning of the session before we heard all our arguments whether it’s good about it who is excited by John 9.
The way it works is if I’m good call barring bad cop you always vote for whatever I say is I like to win.
So I also work with the London Jug and the virtual jug, and I work in develop relations as well. So I work as a developer advocate for a zero turn around, but let’s get started suck Java 9 the debate the way this is going to work is going to play good cop bad cop we’re going to take a. Number of the major job annoyance of the minor Java 9 updates and one of us going to play a good got one of us is going to bed back up. So the good cop will look at some of the party of parts of that feature the bad cop will look at some of the parts of the feature went on, so good and when you as the jury have heard. Both the pros and cons you will vote as to whether you like that feature in Java 9 or not or whether it’s something enough for you to migrate apps.
And I’m also a leader off a jig grouping party in a sauna, which is a very small town but there are probably wrong.
I’m a co-leader with Simon of Virtual Drucker, which is the Java online only Java user group. So if you’re late enough to join your local Java user group. We will welcome you will be happy to have you.
Couple of things that I do I maintain the or block older blacks where we publish technical content. So if you can check it out it will make me personally very happy.
Yes. This is me. My name is Alex. Life, I come from astoria, I work for complete cold zero turn around as a developer advocate.
Okay. Hello. Everyone and thank you very much for coming to our session we appreciate this whole bunch of really good session. So I. Thank you for joining our one. My name is Simon. Mabel’s my colleague election, I’ve hello. IRA, and this is a session on good cop bad cop guides Java 9 so who’s heard of job and 9 so far and java one most people i would expect out on a wednesday. So we’re going to a slightly subtly different orry Outlook on this session started to be a regular session we’re going to be a good cop and about cops. So that’s possible introduce ourselves.
What a horrible movie star concentration sorry. Sorry. You had to hear that.
Really.
Or we mixed back.
This sound louder. It does not like that. That’s the proper way to do it.
1 2 1 2 excellent can you make me louder than him. Please.
1 2 1 2.
Microsoft, yeah.
Wow.
Hello 1 2 3 1 2 3.
1 2 1 2.
That’s 45 minutes. I don’t think, I think that stuff.
JavaOne Keynote Subtitle
I made following subtitle for JavaOne 2017 keynote which used Microsoft Cognitive Services.
Following is the all conversation, the bottom is first, the top is the last message from George.
**********************************************************************
Thanks everyone and enjoy Java one.
One of these things I will mention tomorrow. There is the oracle code keynote. It’s 4:15 at the marriott marquis. He won’t want to miss this after the wall is generally regarded as one of the founders of modern dev ops and Bust Benson is from slack please go and check it out. It’s free for all job one attendees.
It’s promised got see a lot of interesting things today. And there’s a lot more interesting stuff to happen at the conference.
Alright Thanks Mark Brian.
One example of the long term investments were making in Java there other larger projects. Not just the ones listed here but many others there’s a continuous pipeline of smaller peters that are smaller but no less important than all of this work was not just keep moving forward faster.
Amber is just one of.
Be sure that we’re laying the foundation for the thing we don’t really want to do. Yes. We did all right. Thank you very much Brian. Thanks marks.
So I don’t know. Let’s you expressed this in the sort of direct way that you want to in the first place. So, you know what we’re saying is worse we switch on the shape, and we’re saying is it a circle is so Casagemas circle extract its center and radius rep properties and then use that to compute an expression for. The area of the circle and simply for the square in similar rectangle. So, it’s kind of saying what you mean without all of these layers of a boiler plate very nice, now that now that’s up that much bigger thing they did on this far, right? So it’s going to take some time to do this, how are you. Going to do this given the teachers are only going to be very future releases will lead to 6 months apart. So we know we’re gonna break it up into smaller pieces, and right. So, you know, the first example, we showed with type test patterns. We do that first and then we can add more different kinds of patterns more different places in the language to use patterns over time of all the way it makes the job, harder cause we have.
Ugly as hell sport even worse that are still.
You let her focus less error prone faster rate factor. So patterns are roar cool with these seem fairly somewhat limited in maybe generalized to bigger cases in the ***. And this is a really simple example, but more commonly when I when we’re called upon to make a multi way decision where handed complex objects which were going to be structure and take out their state, and then do something. With him. So as an example, let’s say, we have a hierarchy like this where you have a shape and you have circle implement shape. And it has a centre radius squared implant shape and it has corner and edge and let’s say we want to calculate the area where I’m saying. So we know, it’s going to be one of these three things we know we’re going to have to take them apart. So we can use more called destructuring patterns to rip through all the boiler plate that we would have had to write right. So if we were writing this the old way it would either be bigness.
Right. Exactly like this. And so now, this is probably the code that who you were that you had in mind when you were writing the code on the first slide in the first place but you couldn’t write it this. So you had to write it in this right round about way. So this is code. That’s more readable more maintainable much less error prone and as a bonus faster cause the other first code was a linear chain of tests by expressing it as a switch the compiler can turn this into a scission tree has. Probably be faster as well. So.
Doing this in a very roundabout way where since I switched the statement in an expression we have to make an assignment in every arm of his which statement, it’s easy to forget to do that in one or minus your. Test don’t have enough coverage, you just have a bug net, that’s lying around. So we can make this example, even better by turning switching to an expression.
So already the code is becoming more readable, and it’s more obvious, what’s going on because we’ve eliminated a lot of the craft but you can still see there’s still some repetition here were kind of.
And so, you know when I if we enhance the switch statement to deal with patterns, which is what we’ve done here we can make this code a lot easier. What’s the new thing that’s going on here are these pace labels. They’re not constants their patterns and a pattern is a combination of an aplique ability to ask are you an integer with some kind of conditional operation that you’re going to do if the test succeeds cafta to an integer. And bind it to a fresh local variable which in this case of cold. I.
So there’s a lot of repetition in this code and as a result. These are places for bugs to hide we’re going to better we can do a lot better. So morally the code on the previous slide wanted to be a switch which is really pretty limited switch can only switch on certain types can only compare against constants.
Don’t we do right?
We cast it Mike.
Do it has the ability to simplify the kind of code where you have to do multiway conditional operation code like this cook code like this. So your hands in an object whether it’s a parameter or you’ve read it in for the socket and it’s going to be one of 10 different things and if it’s this you do this and it just do. That. And this is how we write this code today. And I’m the one hand there’s nothing wrong with this code cause it’s really kind of what you have to do on the other hand, there’s like everything wrong with this code, right? So it’s propose right. It’s repetitive and the problem with repetitive code is a tends to be error prone, you know we do this by cut and paste without a secret shop in the sense that it was just like a taste of China season. May cut and paste errors and, you know the repetition is really overwhelming, right. So not only are we saying are you an instance of this you can have that but after we got into this up to ask the next what’s the next thing we do.
And more recently you started to see object oriented programming languages like say Sharpen Scala adopted features, well and we think it’s really good for Java. And so sort of to motivate would why we think I don’t magic is interesting.
So what else going on in amber? Okay. So the next I want to talk about is actually a much bigger feature and I had to teach I’m really excited about is called pattern matching pattern matching is a feature that’s been around that’s been associated. Historically with functional program language.
So it will be in a production release in March excellent. That’s pretty cool.
The actual commitments the Trump last week.
Okay. When we have this. So it is already committed this will be I think this is been committed to Jeannie. Katie Mcgrath stories and should be shipping you mean anything got 3 18 doc three sms.
It’s not dynamic typing reason not to have typing it full static typing that with the same static typing we’ve always had it’s just a compiler figuring out the type of thing from information. That’s 40 in your program.
One of the things that we’ve noticed is that at least in, well written code that name is actually more important than the type of book is it talks about how the hell that variable what it means in your program. Not across all programs man. So if we allow the compiler to infer the type for you the effect that it has is to sort of bring the name or front and center put some more important information where we can see it like this. Exactly. So the almost the first thing you see are the names and, of course, if you pick bad variable names then you’re totally unreadable, but we didn’t I’d never been I never I never knew that he is at home.
I know what 1 1 of the sort of sub projects of amber is called local variable type inference. Yeah. What’s that all about, okay? So look they’re both type inference is a feature that we’ve seen in the number other languages but, you know, before job as head type inference for many years, and we’ve used it in some places the language. And we’ve expanded the set of places that we use type inference. So overtime type inference is basically just the compiler figuring out the type of something without you having down and, you know, you can make a code more readable by getting unnecessary information out of the way, so we you. Know why this next generation is simply extending that to the way we declare local variables give an example, I think here’s some typical Java code. So, you know, the way what you have to reno declare things in Java is you say that type first and then the name.
So project amber four. Do you mean exactly by right-sizing language Germany? Well, you know, as you might have noticed Java has a bit of a reputation for being alone with boilerplate intensive. Maybe it takes a little too much code to do a lot of common tasks. And so project amber is A is really a collection of smaller features that are aimed at reducing the overhead of the ceremony of things that we do every day streamlining everyday coding? But also making code more readable and more reliable and, you know, these are features that we can deliver overtime and I think a lot of them are very good shape for the kind of program models that are popular in. Cloud like that function as a service demo we saw earlier or reactive event based systems like that message based systems are actors.
Learn about one of these projects please welcome Brian. Yes language arts.
Fine concurrent programming.
Number is right. This cop, right sizing language ceremony at the new project not yet proposed with being discussed, right? Now this project loon which will endanger bring continuations and fibers to the Java platform.
Holla does not specialized in Eric’s value types.
Here’s some examples product Panama seeks to improve the connection between Java and native data in a debate of code.
In investing in that pipeline for years and you’ll be getting it.
Don’t be a long term support release every three years starting in September of next year. So if features are going to go in only when they’re ready, then we need a pipeline of features that we’re working on, so that when a release comes around we can light bind to and figure out okay. What’s ready, let’s put that in and ship it?
One after that will be September 2018 whenever that will be march 2019.
If a future miss is the current release. That’s okay, because it’s only 6 months until the next one. It’s not that big a deal we think this is a good balance between fast enough to deliver innovation at a regular pace and slow enough to maintain a high level quality. So the next feature release is five months away March 2018.
On a strict time based model in this bottle features go in only when they’re ready.
You wind up with releases that are grand majestic but they’re just rather slow moving for Java to remain competitive in this day and age it must not just continue to forward it must move forward faster. That’s why we propose doing a new feature release every 6 month.
Jay Decay. He bawled in large irregular in somewhat unpredictable steps each releases had one or a few really big features and the schedule of those releases has been adjusted as needed sometimes more than once in order to accommodate this big features that. ‘s good for the big features that gives them time to bake but it’s bad for the smaller features because that means it take and take a long time to deliver them even if they’re ready long before the big. Features are finished.
So tonight is here at long last what comes next to understand more about the future. Let’s take a brief look at the past for 20 years.
Who is it doesn’t matter not ring horrible indium to a new API excellent. Okay. Thank you very much again, that’s great gig.
I really like this one I tend to read your calls for years, and if I need some on my definable what I told you not be used that I’m really sorry. I gotta fix it. Now.
Not going to sing in interpro gated annotations that is going to be removed. So it’s my it’s kind of various things that initial soldiers figuring that out instructing this out to where about using something else, but of course is compiled but still it’s quite nervous now and you see the year. Or here in the right corner there is a program here cool cool.
I she’s back and take a look how it looks like now and if you take a look closer to this fire we see this highlighting this is really nice feature 9 and it’s called.
From the height, how are my dependencies are, so I can do this one. So I can get into gram. I see that my module depends on some three modules transitive dependencies stating dependencies present work in decatur here and see that’s a static chorus. That’s transitive requires. And so on. So and for example, if I decided to add some more grimentz for my application say I decide to spike.
And he needs to take a look like.
Just started that’s it. And, of course didn’t with one module is not that interesting. So let me switch to another example, which here. So I have some more information here. And if it’s tricky to understand what’s going on here I can just negate between modules. For example, I can take a look or on the job sources if I need some information or inside with, for example, what they could use it explores or what services it uses, I recognize that model network A a.
The model of my men cost is now exactly the same as specified were here and if we take a look closer to the common line which we have we see that Asian stands that this is some other application do some. Other path minus be for sure.
Turn back to the final we have accomplished here over here and the problem is that the image beans on the learner in Java base management model, right. All right. So I just take a look on the highlights of its shows us that we need to include this requirement to make it work, and instead of typing it manually, I can simply click here and say please include from Maine an. Efficient back. We see that there is no wires that does the trick for us. Now, let’s start this application lots more started here we see that.
And here’s the really nice day, this one is associated this main course is associated with them on a module. And here’s why if it’s like a little closer in the common line. She lived she still runs it path. So we just the same way is returned to start a pic ations years for years and models we need to turn this application to rise to pick ation. So for that we can simply create the modern four and the root of those further like this call it’s from France of board demo, for example, and ensure have anything what we need anything which we used to completion. For example, it helps me to write anything, I need. And so on.
Okay. So this is a small pick ation it just brings hello. World that brings the ocean of Java machine and then it springs the module, which is associated with the boss is, you know in German I anything is a cost associated with model even with all my classmates. Yeah. Exactly. So little tricky.
Jaggers ascension three. This is actually build. So anything can happen.
Thank you for having me. So I have a demo with an elegy.
Not for us.
Course, you use to use 9 most people won’t be like me in using maximum and most people use an actual ide all of the eye all of the well sorry intelligent eclipse already support support java 9 that means i’m told will. Support it pretty soon to demonstrate how intelligent idea. In particular sports joke of 9 i’d like to welcome you gene petrenko from generates.
Okay. So that’s just skimming the surface of some of what’s in 9.
Okay, we switch back to duck place.
Corba module as well as some others have been deprecated in 9 by we’ve enhanced to deprecate defecated annotations to include a sense of value identifies the reason released in which was deprecated and for removal of form removal is true that. Expresses the intent to remove this. So beware about is on a limited lifespan.
So your score but it’s got a little graph you can find out what things that exports what things are requires all the other pool information is there something I’d like to point out about this is this annotation.
Yeah. Let’s look at a couple of other marxloh here’s a popular module.
Are you can also.
Jane’s Abis specific to the models stand there you go. There’s gotta line module you can scroll around in it learn about what’s in there.
You can find entire model suppose you want to learn about the goggle the New Module Dropout Langone Module.
There we go.
Let’s see the javadoc about mapped out method that we just used it does search ahead tells you all their healthy alternatives can see here if you look carefully how we implemented like the first 10 combinations as explicit methods. Just just to be efficient, but it works case it’ll take an array of elements. So mapped out of click on that whips click on this.
So.
Type you can type things up here. It’s all it’s just the *** any servers is entirely in the browser view shows the Javascript actor. He is good for something.
Another cool feature is javadoc search might have noticed about my browser got tripped up on this little earlier go back to that javadoc page job. Now is a search box?
Not quite it quite as slick as built in as let building language feature for it but it’s just about as good.
I can even say map of.
Makes me a list I can say set up.
See history’s great. Okay. I just made a hash map but it would cost either create, you know there’s a there’s an internal at there’s not a missed class created just for this purpose of Jesus. It’s insane. So happily we have a much better way to do this in Java 9 there are some convenience factories on the price the primary collection interface. I can now say list of.
No, yeah, thanks.
Why did you run?
Show you this but you have to promise not to use it.
Some people call it a double brace idiom.
Now and then now it’s on modifiable. She even worse suppose you want to make a map how do you make a how do you make a constant mapple, there’s no syntax for that there’s this really gross dirty ugly hack.
Type and listen for the win.
Modifiable who.
Fortunes start on.
You shouldn’t be modifiable.
Any other works. But all you wanted to make that modifiable because well, it’s a constant hash set it should.
Yeah. We knew that what if you wanted to put the output is actually want to make a hash set, well you can do hunter have set.
Are you do this, you know what he would you think about it kind of stupid as it makes an array containing the strings and commercialism is like I want to.
Okay. That’s cool. So another another cool thing in Java 9 is collection factories how many people wish job after the cat literals for collections. It’s pretty common request going back to New Year’s, well, we thought about how to do that. And it turns out there’s no great way to do it, but we now have collection factories that mixing make this much more convenient. You just need to create a little collection. It’s got constant content in your gut today. What do you do something really boring like arrays dot as list of what do we do?
Actually save your sorry for a long time here. So I did like three days ago.
Yes, it’s got history. So you can go back.
They show is good, it is extremely handy for just doing exploratory of programming figuring out what’s going to going on before you write actual code going to work now. Of course, it’s not.
So here’s some string and now I can type zero comma three and just get through.
Show you the alternatives that you have in any given point.
And even.
Happened. We should I can do it down, right here, and it says there’s a link message you going to go back.
You can declare variables and assign the values.
Racial is finally Java has a redevelopment print loop who you can talk little expressions at it.
So the first is Jay Show. I talked about it last year, but it’s so cool. I just have to talk about it again.
All right.
Many other great features in 9 large and small i’d like to show you few of them right. Now.
It’s not the only part.
9.
Is here.
My colleagues and I are giving a number of sessions this week. These are the times they all have to be in month must Coney Rep West groom to 16 you’ll notice the prepare for gay gay 9 by allah bateman was given up this morning that there are likely to be repeats of all. Of these sessions they just have not been scheduled yet. So pay attention with online schedule and you can probably still see it at some point, I’ll expect lee will present the middle too, and I’ll present the last two for an even deeper dive I highly recommend a new. Book just out from a Riley Java 9 modular tea by sandra makan paul backers a comprehensive and pragmatic guide to both the model system and the modular platform and of course there are other books cover gigs on 9 and they’re either. Don’t lao work or will be very soon.
I want permission you can visit the jigsaw project page Virginia Gay community. There are links to all of the jobs that video game Hanson’s borough proposals and the gesar from the standard parts of the module system itself.
So it’s open as well. We received tons of valuable feedback along the way. Thank you everyone who contributed a good insights and experiences and I’d also like to thank the long term contributors jigsaw who in some cases have been on this project for almost as long as I have.
Kicks off course has been part of the open source gay project developed in the opportunity gay community.
It’s always a strong foundation for the future of Java it also supports the broader themes. We’ve discussed here today and scaleable is we’ve seen it’s easier to evolve and it’s easier to evolve more nimbly. We cannot remove entire obsolete models weaken the delivered new yet non final Apis an incubator models for early testing and feedback and thanks to strong in capsule ation we can change the internals of the game whenever we need to.
Good modular eyes your own applications before all of their dependencies of in modular ized, and if you maintain a library or framework. I encourage you to publish a module rise version of it as soon as you can but not until all of its dependencies of in modular ized from the bottom up.
Do modular eyes jigsaw it does make it try to make it easier by providing tools that support both top down and bottom up migration.
It’s been a long road to jacks off. It’s been a long run to design and deliver it will be a long road to his white adoptions. And that’s perfectly fine many of you will make use of the newly modular nature of the platform long be look before you use the model system in your own code using heartily new code is relatively straightforward model arising. Existing code. However can be a lot of effort as we learned with Jake itself.
Help you get ready for that future in Janie Kay 9 there’s a new tool called jade apps that you can run on your own code you run jay depth with the date that with the jade chae internals flag against. Jar file or class file it will go do some static analysis to figure out most uses of internal Apis and suggest standard replacements if they’re available I highly recommend that you check it out.
But I do mean for a while eventually we want to do the cage when joy all the benefits of strong up solution that I’ve mentioned earlier. So we will eventually reach strengthen up. So the addendum to the statement is in a future release code like this will not run.
So that all code will continue to work for a while.
So we’ve deliberately relaxed strong in capsule ation of a siege decay internal packages in Jay Kay 9 at run time willing.
Gratien takes time migration from bad habits, especially in take time.
A lot of developers deploy Orzan users just aren’t ready.
The answer is.
No wait a minute, you might be thinking why won’t I get there is a run time like, you showed earlier for the secret class in com poodle if I have a jar file build which indicate that goes and tries. To construct one of these 6 500 things why don’t i get an error message like this.
Well in general if your code uses Jay Decay internal Apis that it will not compile under the game 9 and it may generate warnings of runtime.
Germany libraries that still use the internal class the problem is all the sudden security packages are struggling capsulated now what does that imply Jay 9.
Is the sun security ex 5 9 ex 500 same class for manipulating or spikes 500 distinguished names. This is a bourbon around for a long time. There’s actually been a standard replacement for it for quite awhile, in fact, not standard replacement that has been there since 1 4.
For example.
Under this because we replaced it with a file in a much more efficient format. And there was just no reason to keep it around but they’re a bunch of tools that read this ids. In particular use this to figure out what’s in a Jenny Kay. So what we did was we provided a supported way to get this information. There’s now a dilo virtual file system guarantee your eye you can open that up and gravel around and it just like used to go around in architecture are.
One is our old friend Artie Doctor Art architecture as a sub format file. It’s been in the data gay since one dog two contains all the internal classes up the cake a file, no longer exists in Janie Kay 9.
You might wonder exactly. What do, well, let’s look at a couple of examples?
I keep talking about internal changes.
And the whole spring framework itself just released runs fine on Janie Kay 9.
Maintain a popular Java library framework were tool if it works fine on Judy 9 then please reply with its name and version. Thank you everyone who replied here’s a list all of these things were climb again, 9 probably a lot more stuff does but these certainly do there are some important things in this list. For example, all the major build tools and may even in great alert their Jay unit testing jeer their central Library’s Jackson log for Jay Hibernate Bite Buddy. And so forth.
Even though many of these changes are pretty absurd, they have scared they have affected son popular libraries and frameworks and tools happily in many cases they’re maintainers have already fixed them. I wanted to get an idea of what is actually ready to run on gate a gate 9 today. So I asked a question on Twitter last week.
Most likely here for a reason there are some minor differences we removed a few obscure rarely used methods and mechanisms to enable a clean modelers ation of platform. Otherwise, it simply would not have been possible we deprecated these ahead of sign in Java Aid. Now, what if your code does use some non-standard or getting internal Apis and buy your code. I not just the code that you write yourself. But the code and all those libraries that you downloaded for maybe in several over the years of those libraries use internal Apis or depend on other intern.
Ever want to thomas core values is compatibility. We took this extremely seriously in project do. So that’s one reason why it took, so long if an existing application runs on Jay Kay and if your code only use a standard Java Sea Apis, then it will most likely work Andre Decay 9 without change.
Pixar breaks some things.
That’s not true.
Exhaust breaks everything.
Okay. Good. So the class of this path is still there it still works, but you might have heard.
In fact, the two can peacefully coexist jar files on the classpath can even refer to Apis that are exported by models on the model path.
Earlier I discussed the module passes something that’s better than the classpath but it is just an alternative a clasp at his still there.
We have a model system. Now in a modular platform. You might be wondering, well, what about existing code do I have to convert all my code into models in order to run on Janie Kay 9.
And it’s going to be in a technical sense. Not that the people communities honest apart mentioned earlier but it has additional benefits strong encapsulation means that we can conceal the internal Apis that the Judy Kaye this makes a platform more secure by limiting the damage that malicious code can. Do it improves platform integrity by ensuring that libraries and framework synapse don’t depend upon the internals of the data kay and finally it helps make the platform faster link time it is an excellent opportunity to do whole system optimization such. As resource compression early verification and head of time compilation plus a whole slew of others. We’ve implemented some of these interesting 9 there are more to come.
Okay, so the modular platform is scalable.
All right. We can go back to the deck place.
It’s just a subset of models or only the models that we lived in.
Now we see we relive this page.
New image is a mere 38.9 will run up to run up to just 39 megabytes and i can run it.
Doctor image containing just this.
And it’s nice to come back to 33 megabytes right. Whereas if I look at my doctor image that I just built a about a minute ago. It’s children 66 megabytes power okay. So now I can make.
If I look at its been directory. It’s got a little hello. Command along with Java in wealthy to teach will be cause.
That’s what this starts with this model path up here specifying by other modules that I need I tell it just for amusing that there’s a whole bunch of command name to low in I do some compression. Header files and skip debug information to make a small. So I’ve got a custom Jerry here.
What’s link a custom image this custom image will have just the models that we need? So I’m using the alpine Lennox Bill but a month from there.
Alright. So let’s look at something let’s do something better. Let’s make.
Only a handful of which were actually necessary.
Hello. My world this message brought to you by all those modules.
And let’s see if I go to localhost.
Run out.
Ropes.
Don’t worry their messages normal goes often does the doctor thing at stuff through stuff.
Soccer image.
Well, let’s make that.
A little darker file that just runs this, hello. World app on the classpath using Jane. I was using a early access build the great again, 90 get from oracle for out for alpine clinic. So, it’s more compact.
Okay. Now, I could run this strictly but when I could when I’m actually going to do is run at the end doctor image going to be a little darker image here.
Look at that time we see inside we’ve got this not only the traditional manifest, but our module info dot class.
Now we’ve got work up in Jail Odar.
Okay. Let’s compile that I’ve just pre packaged up the steps here to make it easy.
Three go very simple model that requires two others Java SQL Katie. Katie Katie Gdp server, and it doesn’t export any of you guys because well, because need to as an application.
Let’s take a look at the module info.
That says Hello Modular World tells you what time it is and gives you a list of the modules in the running image. So it’s just using the stream API to get a stream of all the modules in that format them nicely uses the cups equal time stamp class just for amusement. And in order to show the time of day.
Here’s the here’s the main class the only class in fact at this uses the built in concina Http server API. It’s been in the day today for a few releases now very handy if you just want to want to whip up a little a little app talks to the Web and I want to spoil the boiler plate here. But the important part is the one the method the mix the content and respond to any request doesn’t matter what it’s going to build a little web page.
Let’s take a look at it hits were given Judy Kaye. Hello. Hello. World. I know very original let’s take a look at the code. So this is a tiny little webapplication about the smallest you could possibly make.
Alright. So I packed up a little demo here.
Alright since the platform is modular. It’s now scalable most applications after all don’t need all of these modules and now we can reliably configure consistent subsets of. For example, if we have a model that just needs the job and it’s equal module and whatever else governor sequel happens to need we can configure a custom runtime system that contains just those all the other modules just fall. Away we produce these new these custom runtime systems with a new tool in Java 9 called jay lake. Finally has a linker, it’s an optional step, but it’s a very important one switch back please.
Okay, go back to the deck please.
An image that run units Jack regenerated by the Jade, okay, bill on it if you like that shows you the sub graph of model graphs for just the Java SQL rose up models means if you require Java SQL rosette you. ‘re going to get all these others.
What’s going to more interesting module Java dot sequel rosette sossego intro said he is more interesting model cause it depends on some others we can see that here the export of the packages that it exports and then later on. We have in the javadoc specification of what are the additional models that are required some turn if you just want to get wanna learn at a glance what’s going on. You can go up here and there’s a little hover Abal thing here you get.
Saying look at with another weapon. I’m not that.
Java language was over all those important things we can go back.
It’s got a bunch of the usual stuff in it.
Some guidance up front is divided into three sections as see the Judy Kaye and Java affects of the bottom you can see this organized this red there for the front pages organized by models. So you can go click around, let’s look at the Java base model here we go there’s space module.
There we go. So this is the front page of the job in 9 doctor otaki.
Course hasn’t these models plus many others including models for the standard development of the bugging tools service providers and Jake a specific Apis since we have a modular platform. We now have modular dog javadoc which I’d like to show you.
So all those connections are crop it prompted basis already is always there and, of course based does not depend on any other modules.
I’d like to call your attention. In particular to the Java base model there at the bottom you might notice that there are no connections to the Java base model module. I haven’t drawn them in because every model implicitly requires the Java base model Tesla model you always have to have it has important classes of that doubling up to doubling string.
Starting with the Spaghetti Bowl of tightly coupled platform components after years of painstaking refactoring we managed to divide it into a set of 26 standard java sea modules.
Tomorrow system helps with a massive and monolithic critique a that’s because we’ve taken the model system and applied it to the platform itself.
So reliable configuration strong in capsule ation. This is a much saner world than the brittle and error prone classpath.
You cannot accept an illegal access air and note in his exception messages we put a lot of information to help you diagnose what went wrong.
With our example suppose there’s some code in comp who lived in instantiate some secret internal class in the con food, you’ll module will you try to compile that will get an error message sorry. Does not iaccessible if you manage if you somehow managed to run it because maybe com food when it when it comes to you to comfort to you to leave to export that package but now is it now it doesn’t.
Capsule ation means the code outside of a model can only access the classes and interfaces into packages explicitly exported by that model. This means you can conceal your internal Apis and change them whenever you want.
Second property guaranteed by the motor system is strong in capsule ation.
Mark on food ever not found required by console if.
You’ll get an exception.
File time you get her message error model. I’ve found consul whatever if maybe come for whatever used to exist but now it doesn’t at runtime.
Now suppose the con flip also required some other model called console whatever. But there is no conflict whatever. Well, what happens when you try to compile this module?
And establish is the proper connection between them.
Com food lived requires a model named Com Poodle. So the model system goes off and flights, it.
These properties. You can’t even express on the classpath much less asked to be guaranteed. The first property is reliable configuration means if one model requires and other than that other module will be presence and none of the models presence will conflict with any others as an example here we have our model comfort. Live again. No 30 user reverse dns for the model name. That’s convention were trying to establish.
So the model system helps us escape from classpath hell because it provides a cleaner and safer alternative to the class path that is the model path when you put modular drawer files on the module path the model system can guarantee. To keep properties when you compile or run your code.
Package up with compiled model for distribution all you have to do is make sure that the module infinite class file is in your jar file, right. There at the top level, then you have what we call a modular jar file.
What do we do with your Java files we compile them compile one of these files, you get a little class file because of class files here is intentional rizoma controversial but it’s intentional because it makes it basically makes it. Easy for existing tool chains to adapt to this new world.
Well, they’re job source code. So they go in little Java files by convention. These are named models actions vote dot Java files.
Models upon which it depends who’s packages, it will use or do model decorations go.
It’s a little bit of Java code you give your module lindane. You name the packages that it exports for use by other models the models that depend upon it and you name.
Correction.
Injects our models are a new construct of the Java programming language they work at the same way that compile time at run time because they’re known to both the compiler and the brutal machine is greatly simplifies development you declare. Module. He ends.
A model is a set of packages designed for reuse.
What is the model? Well, it’s actually pretty simple at a high level.
Is models.
Please do problems the missing abstraction as we all know by now.
Figure out what it ought to be added to the platform in a way that sit, well with everything else that’s already there and, of course while doing that preserve drop is key core values of readability simplicity universality incompatibility.
We addressed both of these problems together by employing our standard recipe for evolving the platform identify the missing abstractions.
Alright. So we have the two fundamental problems.
Alright. Thank you very much. No, I’m not done to work it.
Demo available get those waiters.
Yeah, type, I’ve done it before.
Just totally, wing, it.
Disapproval and error prone classpath, the other is the massive and model usaac ready case, I’m sorry. I need to interrupt right now and ask for the prompt screen to come up on the dss.
If we set out 9 years ago believe it or not solved to the fundamental problems in the java platform one.
I’d, I heard those ***.
Is here.
That means the jigsaw.
That means.
Tonight is here.
You mark. Hello. Everybody welcome to Java one.
So what I like to do is now transition talking about where we are Java 9 in the vietnam war the language might be going and who better to do that. Then the one and love Mark. Reinhold The Chief Architect Are Java Mark.
But I think the way to think of this is like avui one, right? This is our first day we talk about setting up Java for the next decade imagine we can do we actually apply the language to this in a much bigger way which is actually an excellent segue to the next of our. Talk.
Please go try it out, I will excited out where this is going by Afghan project. I by the way if we didn’t say the name. So please come try it out please give us feedback please come participate in it. Now one thing I want to say about this the last thing I want to say on this check showed you this demo to super amazing demo. I get chills every time we talked about the complete able features API. :
No don’t worry sever ties are for the password boom. It’s open source right now, all right. So.
All right. Hopefully my two factor, I’d like us.
Well, the danger zone.
We go. All right. We do this is going to happen.
It is. :
One cup states actually questions going to be open source, right? That’s the plan mark did open source, right? Now it isn’t but probably should be like where John one. I said we do it. Let’s do it, all right to search the app and project right now.
Thank you.
We can see now we’re starting to fail. This is a visual representation of all the functions that are being sequenced in ran from each other including a nice fan out capability if I click on any particular node, for example, this one I can actually view the entire call. Stack of how this particular function was called this is really extremely powerful. I have it was composed from detect plates. Here’s the lock but I got for the text place I can view all the way down to the scraper, which is what the first function is in our sequence all the way down to the flow function. And if we look at the right. Of course, it’s already finished. I wasn’t able to show much but we get all of our images in slack and finally, it’s finished scraping. So I know this time it was extremely fast, but I hope that you got to see just a sense of how powerful the femme projects can be and why we’re so excited to announce it to the java community today.
We see that we already have a couple of running we have a number of complete in the middle this is the flow you I which shows here I’ll make this big which shows the fan out. So the top we have let’s make this bigger.
Call is a wrap around curl which hits the server which in this case happens to be right running locally on my machine and then my app name is my app its flow. So once it starts running. The first thing we’ll notice on the left is a number of functions are starting to spin up.
That payload and I can pipe it right into afon call.
So if you look here all I have is a simple payload touches on file. It’s just your standard Jason three input variables license plate car usa were going to pull 20 of them and because haffen the functions actually take standard in as their input. It’s very, very simple, I can actually take.
Yeah, I was on the Wifi before don’t ask me why.
So I quickly plugged in the Internet. Right? As I came on stage. So we’re going to see if I have internet but we’re going to try and run a demo.
So it’s a very powerful concept that. No other workflow system gives you today.
And one of the things to know any variables that were created inside the enclosed scope whether part of the heap or the stack gets reconstituted in all future invocations of any functions inside that scope.
So couple things I want to point out. Of course this looks like a single Java program. In fact, it can be reason about just like a single Java program we can test it we can use Jay Unit. We can put breakpoints we have our familiar IDE. It’s a single function code base but behind the scenes, it’s being broken up into sometimes hundreds if not thousands of function invocations. In fact every step is a different Javy En that were running in a massively parallel environment. So you get all the benefits of the functions as a service system such as the economic model of only getting charged for the milliseconds of these things are running a massive parallelization and also the operational benefits without the complexity of. Dealing with functions of the service system.
Which then tells us whether it was successful or failed? That’s actually something that I had no concept of before in the first version of this stuff because we had no concept of a complete workflow.
Which gives us both the Twitter and the slack function which post to those and when it’s complete we have a win complete method.
And once we’re finished with that we run all up.
Once we do that we get basically the nice fan out capability that I talked about before. So then we fan out and we run the Doda plate detection. And we also run draw.
Thank you pose add steps to the computer graph and returns a future that represents the completion of those steps.
Once we integrate once we invoke the scraper we get back to flow future object that flow future object implement the standard complete able future API that was introduced in Java 8 along without api comes a number of promises methods that gives. Us all the nice workflow that we want such as then compose.
Black here.
It’s really great thing if you look at the top we have our scraper that we invoke.
Look at some code. The first thing we’ll notice here is it short sweet and simple.
What we’ve done is the couple dollar functions from each other. And now we’re back to the proper architecture for functional development.
Enter Afan Flow Afan flow gives us a programmatic way to remove those hard coded indications and move them into their own function called the flow function.
As you can see we have a number of red arrow is here and those are, no knows that’s where we have hardcoded invocations of each function from the previous one in order to call them. It’s almost an anti pattern it comes to micro services and functional development.
Basically what it’s doing is point images from flicker of cars detecting the license plate on that car getting the actual value of the license plate using the openal piar library, which is an open source library and then it uses. Open Sea Vita drop box around the license plate and send all of that information to both Twitter and slack.
If you look at this application it consists of five functions.
That’s actually what I’m going to demo today. So in order to show this we built a demo app called Vista.
Today. Of course, we’re announcing that Java is the first officially supported language.
Flow is a system that enables developers to build higher level workflows and orchestrate your functions in a more complex environment you get things like sequencing and chaining parallelism fan in fan out air handling state management all from the language. Of your choice.
Finally we’re announcing the old finally gives you a test harness to test all of your functions using Jay Unit rules don’t forget, that finally we’re announcing def ense flow.
The job had took a allows you to easily bootstrap your Java functions. It gives you a data by the model to find the input to your functions to common Java objects in types.
Two were announced any affect Java SDK or function development. Kit.
It runs locally on your laptop. So you can get depth property working locally both in the cloud. It’s fast scalable and container native.
For one the Afghans server in server is the foundation of your functions as a service platform. It’s what enables developers to build deploy an scale functions in a multi cloud environment.
Hi, I’m super thrilled to introduce to you the afon projects and project today consists of three components.
My screen.
Thanks Mark.
We talked about the distributed operating system. Right that go into the cloud. We need a language to help us with those problems. So we’re super excited talk about what we’re doing next we’re going to talk about an open source project recreating the container native completely legname language in Gnostic, but there’s a portly and exciting java layer putting into. Just solve those problems. So what am I to do is turn the stage over to chatter myrrh for my team to talk about what we’re doing. So chat stage is yours.
What you need to solve those problems, which I was exist invented for the first place, right? You language 22 years ago java solve this problem is why it is where it is safer running on top of an operating system where there was lennox alaris windows whatever.
Nothing better to do that.
Microfine Melzer computer science are always with us, right things like concurrency and synchronization state matter. These are hard for any reasonably science application or recently slides micro services.
Every cloud providers got one of these things something like a Vienna goes up to being goes down publishes an event to a bus you get some cold executes you can take some action super helpful to amazing for that use case. But it’s easy to be tricked into thinking that snap depth platform, but it’s not.
Again, having worked in the class piece for my you look at this and honesty where we are in space in the industry is actually pretty nice. It’s right without the today’s litterae triggers for the cloud.
But.
Important we talk about applying service to our code we deploy we think it is functions as surface, and it’s kind of a beautiful model. Right cause it, they let you focus purely on the logic of your code purely on business logic not worrying about infrastructure not wearing about that like that in your system, and probably give you an amazing economic model two.
Databases to storage.
But it’s never his mind today. If you’re not familiar with the services compute abstraction that takes away all notion of infrastructure from use developer applies to many things place to compute.
Wow serverless.
Thing that we don’t wanna work here if you guys are interested there’s a much more in depth session tomorrow morning 8:30 i know it’s only in the morning but they believe me we watch our time everybody and you.
Thanks so much this was just a sneak peak of.
Which is causing the league, no, if you’ve ever had to troubleshoot a memory leak issue in production before you know, how incredibly difficult that can be and how much easier? This is just a tip of the iceberg when it comes to the power of pure far under excited to bring you all that power to you.
And if you look closer it looks like I do add reference had these objects to the headset and remove them, but it turns out that I forgot to override equals and get hash goat in this class.
Go to line 63 right. There is right allocate the object, no surprises there. Let’s go back to the reference change it looks like this hash set. Right here in progress items is where I hold on to these references.
:
And the reference change showing us the chain of references, that’s preventing this object from being garbage collected so let’s go look at the coach. So it looks like line 63 here of my league appropriately named leak work item class is where i allocate this object.
Click into an individual sample, we get very detailed information, we get a stack trace showing us. Exactly where in our code the subject is allocated.
Jeff our house is cool new feature that tracks the lifetime of a sample of allocated objects and using this data we can tell which objects are hanging around on in the jovian for longer than the shirt. So let’s take in and see if we can pinpoint the source of this lake looks like in this case we have some samples of bytearray hanging around for longer than they should.
We did find a memory they and as you suspected. It’s only affecting one of our parts.
Probably means it has a memory leak. No, we do a lot of interesting analysis on this data that we gather from Jeff are, so that we can find the problems for you and you don’t have to go looking for them. So let’s go look at this analysis tab to see what we found.
No, Jeff Are has this has a lot of very useful and deep data, but today, I’d like to focus on the issue of memory leaks. If you look at this graph up above it shows you memory usage by each of my parts, right after garbage collection, and it looks like two of them are doing, okay, down here, but one of them is having a little. Too much fun and using up more memory than it should.
Because like you said, you don’t know when the problem’s going to show up where it’s going to show up for that you even have a problem.
I know one thing I’d like to reemphasize it burn already touched on is that this agnostic service is a very low overhead service. That’s designed to be running continuously near production cluster.
There’s my screen. So quick note about the set up for this demo. I have three replicas of my service running on a kinetic cluster with the diagnostic service gathering continuous Jeff are recordings of my service.
So I would like to introduce a container diagnostic service that helps you do. Exactly that this service once in production is always on provides real time data with very, very low overhead, it gives you the depth of data that you have four provides the breath across the service George here will actually give you. A live demo of the service. Now. Thank you very.
The issue is no longer just what is my performance issue, but we need to know when it’s happening and where exactly is it.
I’m sure almost everyone over her how to deal with profiling applications and mark kind of effort to this java flight recorder makes this really simple for a single Javy Emme. But the problem grows as we move to the cloud and even more to Microsoft says I’ll be doing right now.
Excited to be here today and she with you all the service that we’ve been building for a while now services focused on making container native development in Java simpler debugging any issues that you guys run into much easier and. Just helping making your applications more performance.
Can do with no performance overhead is fantastic, but we need to help you scale the cloud we help, you in the cloud. So I’d like to do is actually give you a sneak peek into service for building in the cloud to help you manage Davy. I’m to scale help you give you real time diagnostics. So please welcome for my teams are in baton George Massey to talk about this.
Importantly though. I’m serving building we always need more information we need more incidents where we can never have enough tons of data that we need to real time information that is beginning of this talk that were open sourcing all of those. Commercial features in the work of Janie Kay one of those things happens to be Java flight recorder if you’re not really rigid far is this amazing like Super Swiss Army Knife. Bless you diagnose any Janey out job application, right? Can see in real time was happening up and down the stack.
I guess operation are fundamentally hard, one of the hardest parts of buildings your resistance and partly if you don’t really know this or never done this before that we think of them that way. Now.
All right. Let’s crack said he talks a lot at the end about observe ability in operation. I think that’s where she talked about next week talk about cloud service.
Move on would like to do is give you some helpful information about how to get started with job in korea nettings we put this together. So worker oracle acquired them earlier this year. It’s fantastic container native see ICT service lets you get some containers in your life portly get some communities here life three launched all this community services I mentioned we’ve actually put together. The other a curated set of Java getting started guide tutorials quick steps libraries to help you get some Java into containers into communities. So by the way, there’s a community Titian completely free. No strings attached there will never be strings attached. So how do you find a useful if not let us know if so please let us know.
You want to get some air life called crack.
Thank you. So much that I’m having a day.
A lot of efforts to make secret integration much more natural into the Java runtime environment. So I’m very excited about the future communities. I think it’s a very natural environment for you run your job applications. If you’re interested in learning more courage to go to the website, and it is to die if you want to get closer to the community feel free to take a look at the cloud of Computing Foundation which is A. Vendor neutral home with the cooking is project and a lot of you cloud data technologies are being.
When many people start looking at lenox application containers they think of them largely as a replacement for virtual machine just a way to package up and run something but if you look back at the origins historically they provided a very. Robust and rich resource isolation framework away to tease apart the set of resources that would be a scientist something that allow you to pack sorry 10 sleep number of applications of the same set of physical infrastructure and one of the most. Heartening things that I’m thinking out of conference.
Final thing that I think about a lot when it comes to the Java community is a little bit nuanced.
And I would love to see, the coming year or two a whole lot of focus on making much more natural Java runtime environment aggressions with the other line committee substrate.
Environment operating system for applications and while it is relatively opinionated. It does offer up as a set of primitives don’t necessary to allow an application to find another application access it.
Third thing that I think a lot of Bob as we look at this environment and the needs moving forwards is the libraries themselves as I said, these provides essentially distributed system.
Another result of that intrinsic dynamic system is the need for high levels and tried to respectability you start to live in a world where our Javy Am you’re a Java application is a little bit tired to single physical machine. Ready understand what’s happening and to be able to diagnose things these new walls need high levels of logging observe ability have access to structured information about the application of a better sense of what happened off the fact not necessarily. Tying that to single physical machine. It’s also hard to see some of that coming out in this very conference.
A natural environment we can run on new job applications, but anything else and you can do that in a way that is perfectly decouples from the cloud provider it works just as well on premise or in the cloud gives. You a great degree of choice and flexibility around where you want to others applications. Now as we look to the future. There are a set of challenges that exist when you started to move away from relatively traditional large structure applications into the small modern Microsoft’s is based environment that Cuban eddies naturally pushed you towards the first and foremost of those. Is the weight of Java if you want to move into this environment that is intrinsically more bite sized it makes sense to have a mobile sized runtime environment. It’s very hard thing to see some of the work, that’s being done to reduce the weight and speed up time associated with Java. So that you can actually get these more dynamic applications running.
I’ll come of that is pretty significant in that it not opens your job applications up to a polyglot world. They can’t coexist side by side that begins other languages if you want but more importantly it opens up them to trust world we can interleave these job applications with a lot of dependencies that they might rely on, so you could. Run a Cassandra Database. For instance on the same core infrastructure using the same on the line hocus traitor that your application uses which is very powerful. What that means that the other the day is that as you have a lot of enterprise concerns like governance for special compliance can rely on a simple single consistent on the line framework to deal with those problems for you as. A result companies effectively creating this distributed systems, but this is distributed systems operating system.
Now, what this means to the Java community is actually pretty significant if you think about the old world could have middleware that would be responsible for running a mission-critical into prize applications. When we started to see is that middleware getting teased apart almost polarizes to different pieces starting to see the emergence of systems like urban at ease as a standard way to run a lot of the underlying services components effectively stitching. Together a large number of machines that can operate as a single logical ideal computing fabric. And then we start to see is a lot of the other functionality getting pushed up into application of a libraries provide a lot of the immediate integration that you need to run this application. So efficiently.
An amazing way to simplify the operations process as your building applications that provided a medically sealed highly predictable unit deployment. She could take your application in this case a job application package it up with all of us penance ease predictably deployed out into a variety of environments effectively the coupling it not only from the environment where it’s running but. Also in some ways from the operating system that is running on creates very high levels of portability, and then orchestration is the final piece. And this is where much of the magic is by using a dynamic orchestrator you can rely on an intelligent system to deal with all of those operation mechanics deploying scaling monitoring reasoning about your application.
Containers have become.
Force times of driving innovation, but it also buses them from metalac which is increasingly important.
Open source obviously is critical. It’s becoming increasingly important to organizations of all sizes as they’re making decisions about the technologies they know that open source provides both an incredible.
And so these are the last three and half years has emerged as pretty close to a standard and it is an open source container orchestrator. So for those of you unfamiliar with it as well just breaking down those three words.
When we set ourselves project. We knew it was enough to just write a letter from the future to apprise developers when you that we need to create something in the open and make sure that it worked as well. With relatively traditional workloads as it did with the four looking progressive dynamic workloads that ran inside of technical cannot google.
It’s really been exciting three and half years since we start the coolness project at what we set out to do back in the day was to bring a lot of Google sensibilities around building and running applications to develop as. Like yourself, I personally was ready inspired by the idea of providing a better framework to run applications developers can focus on code at expert systems underlying the application languages could deal with a lot of the monday to tease an. Challenges associated with running those applications.
Thanks so much for every year folks.
It was a start up focused on bringing through net is to the enterprise. But what makes him as an expert is Craig was actually one of the co founders of the Pyrenees project turns time at Google. So crack thanks much for being here.
We’re doing a lot with it. We actually figure do a lot for Java two sort of like to do is have you here for a subject matter expert communities why this is right for Java developers. Why does the platform you should build micro services on? So please welcome Craig Make Lucky Crags Deep CEO and founder of hefty.
But it is the right open source building block that abstracts away clouds abstract away infrastructures gives you this distributed in substrate to help you build resilient micro services were taking a big bet on it. We put a lot of people in the community project we have announced several communities focus cloud products early today on the other side of the fancy open world.
Like the thing that helps us get a distributed colonel addition substrate, and if you don’t already have one, you’re asking what should I build we have one. It’s long in the two. What should you next are painted Java arcade oracle is you should use communities.
You realize we all have the same problems, right? We all have to build effectively the same thing to solve that same challenge again, and again.
If you’ve been to space for a while, I’ve been working on cloud systems for a while, you see that an architecture of the steep Pizza Nicolas gave, you.
Thank you so much that goes so.
Thank you very much.
If I never take us your interest, I’ll be running a session in just a few hours. So feel free to come along if you want to hear more details around how we think and build our back end services.
And this is it has enabled similar to what I describe from our micro services for us to scale data processing and machine learning to the scalar out. So this is a logical equivalent or Microsoft architecture for that for data processing.
We schedule these using another open source framework called sticks, which is a doctor scheduling framework.
Our data processing framework is based on Scola. It’s called geo. It’s been open sourced. It’s a way to build pipelines that drama on tops of Google stay to flow and big cricklade products.
Where not only using the Javy Am four are back in services. We also use it for our data processing and machine learning.
All of these runs in a complete clone in multiple data centers around the world for us to be close to our users have low latency, but also to be able to do full data center failovers during large scale maintenance or. Or incidents. And this is something that we do actually fairly frequently.
These services are stateless they don’t do anything on their own. So they found out to the lowest layer where we have services that do the actual data processing and storage.
Picture on the right in this slide shows a very high level view or architecture. You can see the perimeter services which are exposed to the Internet. There are very hard and they manage are things like with indication of requests were back in, I will route your quest down to services filter out the next layer is what we call the aggregation layer. This is services that deals with things, there are very close to what you would see in our clients at 1 2 1 representation of views in our clients.
And lastly the name is has to have ownership of the service firmly within the team that pills that service so you run what you build, and that’s closest are important feedback loop in between developers and operations.
We also have it also means that we have limited impact when we actually have failures. So it’s service might fail for whatever reason but only a subset of the feature set on spotify or only a subset of our users might notice like if the search service would fall over that would only affect search. Functionality on spotify not streaming or play listing or whatever might be the case.
Services that powers the features needs to be scaled in different ways.
We can scale them independently different features as part of I is very different interaction patterns. And.
As we decided to start exploring Java. And in a bit later in moving over to Java being able to do that the incrementally service by service acid made stems was a crucial way for us to be able to do that, that change having small services. Also means that we can as humans easily understand and reason about them.
One the very early in the organdy the best decisions that we’ve taken architecture wise disband to design our backyard as a set of small single responsibility share nothing services what the pattern that is now known as Microsoft’s architecture.
Did you maybe Emma had this nice property where we could actually observe what was happening at run time if that was collecting runtime metrics on the platform itself or if that was profiling the service while running in production both were. Very effective ways of knowing what was actually happening to the surf.
We notice that during the scalability is that stuff we had it painted a much more’s stable way than anywhere other services.
We have one service though at the time that was going to method in Java it was our search services it’s actually still around.
Run into some pretty constraining scalability classrooms.
And you’re in math changing heard mark mentioning this quote of his and this is very much true. For spotify while Python was an awesome way for us to get started and to be allowed for back in as fast as we were young company we.
What if I started out as a Python back in.
Now dealing with this scale turns into pretty interesting and challenging technology problems as you might imagine.
And we have more than 4 million requests to our back end per second.
If you ask me what I think is even cooler than that is that we handle more than 3 billion streams per day.
Where at more than 140 million active users?
Since we launched in October in 2009 as his smaller swedish startup. We’ve grown pretty quickly on where now at in 61 markets around the world having most recently the worst team in thailand.
We also want to give our users to features that they wanted more to be able to discover and listen to the music they want.
Platforms that might be good and once you see in the picture here, but also embedded platforms like TV sore playstations or stairs fevers.
Spotify is a music streaming service we provide our music your users with the music they love on the path forms where they searched.
Hey. Thank you very much for having me. :
Challenges they faced what was hard with still hard importantly. Why they’ve used Java. So please welcome the stage Nicholas. Kristof’s and he’s a principal architect is spotify.
Now, you can’t account for his like this are open world or technology conferences in general, you can hear a lot about the business value of cloud, right things like opex, capac’s plasticity almost things are true. We’ll talk about it means to Delaware Developer Developer Conference me when you boil it down hot is about building a distributed system at the end the day those are hard actually super hard the king of the way of saying. It changes the way of tool is the way we build deploy scale operator services. So I’d like to do is actually talked about what’s an ecosystem and we’re going to do in Java itself to help you in the cloud, but I like to do is make sure that we have a common. Frame of reference for this right talk about one of those hyper scale web companies that James metric that we all think about never been in Java 1 4 new face and i said this nice and fresh ones of those come talk to. Us about their architecture.
The very beginning this 55 percent of jade mess today or acted in cloud. Somehow when you build for world of a hundred percent, right? That’s tomorrow as class pervasive does it matter what you work on cloud is in your life if not already.
It’s actually super validate for us to hear that I hope you’re as excited about the future job as we are what I can do now after every night from James is actually move on a little bit. Of talk about cloud talk about job in the cloud.
Funny of runway to go and I think that’s less than it was very important to be open sourcing happened. And we’ve got a new version of Java coming out and the notion of a 6 month cadence is going to be a big big deal. So it’s we had a couple of years will be here we will have had the low hanging three done a lot more development in Java language. Thank you.
But generally you want something you can rely on something that stable those companies found was that in fact in terms of observe ability performance trace ability and just the ability to manage something overtime Java and Javy Me had a real. Value there isn’t really anything out there the replicates the power of the qadian today. So we can accelerate the language development and begin to make it more like the modern developer expects, and that’s what the challenges oracle, then this this serve.
Hey go. So I have three kids. And so I’ve had various times in my life with night don’t sleep through the night.
Boston break things but who likes to sleep throughout the night.
Yeah, it’s all very, well and good.
I don’t think it’s back to something that.
Collins is called the thing at chop up the simple fact remains that off the language and not just the jackie. I’m Mara thank. So let’s talk about the chase am I think why did those web companies decide that they needed to adult Java on the coast of the skills. There’s so many skills available if you’re hiring people out of computer science chances are high they’ve got Java skills.
And it’s been very interesting to us that it’s not a lot of people would say perhaps the job was not as much a part of the new world, you might expect that it is pulled with Frank Overtime. In continues we generally see Java and Javascript on the top of the rankings and there are tons of coolly languages out there, there’s developers and, yeah. Everything is going to be rushed or everything is going to be go.
Conversations in stack overflow against 12 happening in get hard.
We gotta from half a minute ecosystem running around for awhile how relevant all my skills. So Redman my company we do a programming language rankings that is every 6 months we do it it doesn’t necessarily change that file so we’ve kept it at that time frame.
So I want to say this is as Java developers that you want to think about it is.
Cross the board we’ve seen Contributions Kafka began as project from again, linkedin. So the fact is that you got launch what companies that want to make contributions they want to be part of this world, but haven’t really got involved with Java because it wasn’t as open as they might expect they also felt. That it wasn’t moving as quickly as they might expect they’re coming from all this continuous deployment will if you told me it’s going to be three years before the next version. Now not too interested in that you know, don’t pretend to have a certain degree of 80 they want something new they want something bright shiny and fast.
I think one of the interesting things happened over the past few years is it option of Java by the web companies. So first generation went companies obviously Amazon very much a chop shop Google tons of Java obviously they have gone other languages. Now, what’s perhaps more surprising is those web companies said look actually we don’t like Java we were going to be going to be Ruby than you know, Twitter we’re going to do really were gonna do repeat that was. Until he wouldn’t scale far enough said updated Java Facebook again, they came out will say no what i’m interested in Java until they became the biggest todo shops on the planet. So big change is very frame hold to those companies that have an opportunity they’re all making open source court appearance now things like in tracing sipc in.
Change pretty dramatically. And in fact, what I think is interesting is that things have changed in the Java ecosystem probably more in the past three weeks, then they have in the previous 13 years this open source move. I think we really can’t underestimate the significance of it. If we’re going to have a chance for the community to flourish if we’re going to have a chance to really expand, I think the ecosystem it was necessary that oracle took these steps.
No, it’s kind of interesting. We’ve seen this long pole train at that time we see some was still around.
I said that did you see *** was the worst form of governance software apart from all of the other ones that we’ve tried.
What kind of contentious at the time?
I should here and I said something that.
Yeah, I think there’s probably some of you that haven’t haven’t quite a bit of the even around that long.
The distant past back in 2004 so who was here in the job ecosystem at that time?
Outside are going to happen next slide by Morris fine. Thanks. Hey buddy, how you doing a pleasure to be here the last time that I actually stood on the main stage Java one was actually a Bhai.
Right. So now this we think actually start to change the future of Java this we think starts at the job in the forefront of everyone’s minds certainly ours but also people that are not currently running Java we think this brings. It to a new future that is not previously existed before. So what I want to do those make you not hear this from just me not from oracle actually can bring out Mr Java Renaissance Himself James Governor from Red Mark to give you his perspective James come on out.
Cool. So which really now have an open Java, right? But it’s actually still not enough as we think about pace, right? The last time it shipped with three years ago. That is not fast enough. So now that open truly free jobs. We just spoke about going to come out you every 6 months.
One more.
Two might be saying, well, you open she can you work in Cheney Cave one of those better in the other maybe have to use the organ Judy Kaye. It’s true. Right. The organ Jayne Kays commercial features in it these things parley power some of the most barley systems on the planet. It’s amazing technologies for help you run Java scale the painter only available to elite few billion developers they need be able to everybody. So going forward. We’re going to open source all of the features in the Oracle Janie Kay there’ll be zero differences in the open Gina came the oracle Janie Kay.
Going forward. We’re going to be producing open Jake a binary under the gpl license you truly now have a free and open job that you’ve never had before number one.
Find those things again look at those rights talk about openness first I came to this group but I was told was Open Shady Kay. That’s a place not a thing that’s not open enough. So now let me shady cases thing.
Also has modules which I’m sure you might have heard about the modules really are this amazing thing they’re gonna let us turn the corner let us involved, right for you they mean you get just enough job I just. Enough gave me your life, you can write seisa Javy am very important for cloud world for dynamic world for us. So we can find the involve the platform the ways we could not do before he could it. So we think modules really are this slim Japan is going to get us to that future again is Java 9 enough. No, it’s not.
I bring you over 150 new features streamlines the javy am partly there’s a lot of support in there for things like minutes containers give you better on management honoring of see groups memory settings.
Right. So 9 is here but is a transformation or at least for us.
Alright. So let’s move on let’s talk about job eassy.
You can speak your caboose please come talked with please come participate by. Thank you guys so much for being here thanks.
I mean, you’re right. We couldn’t micro profile over a year ago moved into Eclipse. We’ve seen a great groundswell in interest and participation since we moved into Eclipse for the reasons that you mentioned earlier that we can be more nimble. And we can react to changes along a lot more quickly moving a key for Jay Two Eclipse. I think allows these two communities to come together and helped drive and a Prize Java into the next decade as you mentioned earlier awesome. So what I want to make sure you all understand with all of us on stages please come participate. We cannot do this alone account keeping offender consortium. So that writers Open Eclipse Foundation please come check it out as a mailing list Twitter Foundation. There’s a panel which I’m sure will be action packed, right after this portly stop by the redhead boots the Tommy Tribu the eye.
It gives them encouragement. I think that the future of Java each strong in the only would of course, and I would have is that having just open sourced open Jay 9 and our enterprise open liberty runtime that took us a lot of work that took. Us 8 years to get us there. So, there’s a lot of work ahead but I think I’m going to be successful. There is a lot of work and we have a lot to do, right. Mark Red Hat obviously instrumental in creating micro profile with these guys on stage a lot of people the community what’s your perspective from micro profile in red hat on what this means?
Jeez, I think that it happened that this has to people from a couple of different perspectives David already mentioned the tesei case access to the test case, which is great for developers. But for food before people building solutions on top of Joffrey. I think having this new communities fine up with anything, I think is it’s.
I wish China shipping IBM’s Javy. I’m since the job flight days. So I think having both the low level Javy Am and you click then the enterprise platform both at Eclipse is a really strong endorsement for Java development top to bottom Clinton, I think there’s a there’s A. There’s a couple of.
And the other thing is collectively you make the biggest investment in Cayey which far exceeds what we collectively in it. And so you having access to the tesei case that if you have a problem, you can go straight to the test and get them an improved it raises the bar on us. So this effectively makes our largest investors enabled to fuel eat and we can all go faster. I think in the end awesome alright. In IBM obviously one of the largest vendors one of the two large spenders of Java Java Enterprise Edition on earth what’s your perspective on this means moving to the Eclipse Foundation? Well, they put foundation timing is a good choice. It’s the one that IBM picked. For example, when we open source tower Jay 9 java virtual machine.
I think that when you look at our industry were filled with so many passionate developers some of them quite young the thing that I can’t help the takeaway is your inheriting eat very real sense easy for Jay is easy for. The next generation.
Thank you guys so much for being here. What kind of do this panel styles we all know here too? We all stayed together brothers in arms David will start with you’ve been open source for 20 years built a fantastic career fantastic company out of it. What’s your perspective on what this change means to the community at large?
But I want to make sure you don’t just hear this from oracle, right. You’ve heard this kind of stuff from Oracle before I want to make sure you hear it from all of our partners, right. So what I can do is bring out three of those leaders of the community along with us here all of us in this together. So please welcome David Leverage that Romney tribe in Robin System ideam mark little from red hat.
Getting through one door at least there, but it’s going to be that’s gonna be a good day for crisis got to set up for the next decade helps modernize.
Reference implications that Isea case that was a huge one table in expect authorship of specifications and portly control.
Serving at the Eclipse Foundation writer going to change everything going she got a lot of questions about this. I don’t think people are quite clear. It’s going to be everything.
What’s your four years ago? That’s not very fast. It’s going to change everything about this, right? We put out this news a few weeks ago people going to very receptive to it were super excited about it, we are fundamentally opening up job in French.
Like a wife not getting a snare actually applied those themes. It’s actually pretty self-evident, right. Is it open, well now, it’s a vendor consortium last I checked those aren’t that open?
We actually did do a lot more to modernize to get you to that world of cloud and micro services serverless reality is he is the bedrock of mission critical systems adjust power enterprise.
Within a presentation, right. This is huge news from a 6 year 18 year brings you modernization the platform there’s amazing stuff then it should be 2 2 async apis reactive apis helps you modernize the platform but it’s not good enough.
People like George the third 12 million Java developers out there which is awesome which more we want to be a billion developers and that’s the relating to building for stock bauer going to get there.
Right scale is easy for us as engineers to think about what’s petabytes of data requests per second or number of Javy me that you manage.
Last week continue to scale.
Right with the use cases it existed 22 years ago aren’t relevant today the things that exist a year ago may not exist next year. So we have to change which get the really quickly to be nimble as we do this, right away get things wrong. We have to get it, right quickly.
Miravalles evolution is actually really hard, right. It’s like it’s very easy to add things. It’s hard to change things. It’s nearly impossible to get rid of things, but you have to do it.
There’s four themes were to come back to again, and again throughout this keynote and really the running uses guiding principles for ourselves in the Java group number. One is openness at the self evident to technologist transparencies important case world. It’s more important than ever and actually we’re just going to show you about this we’re not going to talk about it that much.
Talk about our going to get there.
Right. Maybe it’s no jazz which apparently you can be reformed from maybe it’s something else. But with you want the next decade to be Java first Java always that’s how we want you to think about it.
Actually even if we take an honest look at where we are today, but we can apply that actual famous read my fault that we all know what love fiber when companies grow up they turn into Java shops that tells us. Something though tells the people are writing a something else first and rewriting in Java we need to change that.
Thank you. All of you. Thank you. George. Thank you. And tell we’re super excited to be here Java Java one really or by you and for you we have a ton of stuff to talk about a lot of new content a lot of fresh faces including mine are going. To talk about the future is George said those stats they put up their fantastic today voting for tomorrow.
I can’t work all that any architected the bare metal cloud. And now he leaves overall strategy for Java and the cloud in container native please put your hands together and help me welcome Mark Cabbage.
It was a Lee developer on a double has at its inception and he let development at joint for just long enough to have been cured completely aventino digest religion.
Full evolution has helped to grow into the most vibrant programming language on the planet moving forward we want to ensure the Java is well positioned for modern development and growth in the cloud and our next speaker is uniquely qualified to. Talk about how jobless future direction will help you through this transition.
Over more than 20 years over two decades shot his continued to bring value to developers in our prices worldwide.
Microsoft Translator Java WebSocket Application
(寺田が実装した Microsoft Translator Java WebSocket Application のソース・コードの入手先)
Microsoft Translator を利用したリアルタイム翻訳については、すでに様々なメディアで取り上げて頂いています。
- MS Translator ついに日本語リアルタイム翻訳に対応。ほんやくコンニャクが現実の世界へ?
- Skypeで日本語のリアルタイム音声翻訳が可能に
- 新生「Microsoft Translator」の実力は? 早速使ってみた感想:週刊モバイル通信 石野純也
- 多言語間でスムーズな会話が実現しそうな「Microsoft Translator」
最近では上記のような専用アプリだけではなく、 Microsoft Powerpoint のプラグインも提供され、プレゼン中にリアルタイム翻訳をする事もできるようになっています。こちらは、まだ実験中のプロジェクト製品ですので、現時点ではお試しの感覚で利用いただければと思いますが、これが成熟することで英語によるプレゼン発表もより理解しやすくなる日が、近い将来訪れるのではないかと思います。
この Microsoft Translator は、プログラミングをする事で、上記の Presentation Translator のように、様々な環境でリアルタイム翻訳を実現できるようになります。
プログラムを実装するための詳細は、Microsoft Translator Speech API リファレンス・ガイド をご覧ください。
かんたんに実装方法をご紹介します。
1. まず音声データを作ります。音声データは、サンプリング・レートが 16Khz で、モノラル、サンプル・ビット 16 bit の PCM 符号付きデータにする必要があります。もし、このフォーマットになっていない場合は、変換をして上記のデータを作成します。
2. WebSocket で Translator 専用の URL に接続します。
その際、認証用の AuthToken を取得しAuthorizationヘッダに認証コードを付加し接続します。
3. WebSocket のサーバに WAV データを送信します。
4. 翻訳されたデータが JSON で返ってきますので onMessage() で翻訳データを受け取ります。
各プログラミング言語用のサンプル・コードがマイクロソフト本社より提供されていますので、下記をご参照ください。
さてここから、より Java 側の実装についてご紹介します。マイクロソフト本社から提供されている、Java のサンプルコードは下記に提供されています。
Java-Speech-Translate
上記のサンプル・コードは、あらかじめ HelloWorld.wav (PCM,16bit,16kHz,mono) ファイルを用意し、その音声データを Microsoft Translator に送信し、翻訳された結果を表示するようなプログラムになっています。
簡単な動作確認をする用途では上記のプログラムは有効です。しかし実際には、より大量の音声データを扱いたくなってまいります。また、最近の PC で音声データを作成すると、デフォルトでは、サンプリング・レートが 44.1Khz でステレオ・サウンドで WAV が作成される環境が多いかと思います。そこで、このような高品質でファイルサイズの大きなデータを、Translator に転送するために低品質に変換する必要があります。そのような場合、上記のサンプル・コードだけでは実装が不十分で、追加のコードが必要になってまいります。
そこで今回私は、上記とは別途 Java 用のサンプル・プログラムを実装しました。
私が作成した、アプリケーションの全ソースコードをアップロードしています。ソース・コードを入手後、プロパティ・ファイルにご自身専用のサブスクリプション・キーを入力し、ぜひお試しください。
2017 Java アプリケーション・サーバ使用状況結果報告
先日は、「2017年度版:Java サーバの利用状況のアンケートのお願い」
にご協力いただきまして誠にありがとうございました。
アンケートの結果を集計しましたので報告いたします。
今年は、アプリケーション・サーバの利用状況に関するアンケートで 514 票、MSA フレームワーク系で 155 票の結果をいただく事ができました。ご協力いただいた全ての皆様誠にありがとうございました。
下記に結果を報告します。(ちなみに、昨年の合計は 669 票でした。昨年の投票結果はこちら)
昨年と比較すると、投票数が若干減っているため純粋に比較する事はできませんが、全体的にアプリケーション・サーバの利用は減少している傾向に見受けられます。一方で投票数が減ったにもかかわらず、組み込みコンテナ、特に Spring Boot だけで昨年の 76票 → 102 票に増加したのは特筆すべき点です。
世界的に増加傾向が見受けられる、Spring Boot をはじめとする組み込みコンテナ系の需要は、マイクロサービスの導入・検討により、今後ますます高まると想定しますが、さまざまな情報を入手し効果的な活用をぜひ行ってください。
下記の今年の de:code や Java Day Tokyo でも発表をしましたが、筆者は安易なマイクロサービスに警鐘を鳴らしたいと思います。モノリシック・アプローチからマイクロ・サービス化においては、様々な点で考慮が必要です。どこから始めればよいかわからない方は、まずは下記の発表資料をご参照いただきご検討・導入をすすめていただければと思います。
関ジャバでの発表でも申し上げたのですが、「マイクロサービスにする事でハッピーになるのではなく、マイクロサービスを導入することでハッピーにする」という感覚が必要かと思います。
Happy Life with Java !!
2017年度版:Java サーバの利用状況のアンケートのお願い
サーバ・サイド Java の開発・運用に携わっていらっしゃる方に質問がございます。現在、サーバ・サイドのJava 開発環境もしくは本番環境で、どのサーバ (Webコンテナ、アプリケーション・サーバ)をご利用いただいているか理解したいと考えております。そこで、大変恐れ入りますが下記のアンケートにご協力いただけないでしょうか。
昨年 (2016年) は、669名の方にご協力いただきました。ご協力誠にありがとうございました。
2016年版:Java サーバ利用状況アンケート結果の公開
今年のアンケートの締め切りは 7/12(水) 18:00 までとさせていただきます。
昨年も1週間のアンケート期間だったため、公平をきすためにも同じ1週間で実施いたします。また、速報は同日開催する「関ジャバのナイトセミナー」で発表します。
複数ご回答いただいてもかまいません。個人情報は取得しませんし、この結果を売買に使うことも決してありません。利用状況について正しく把握することで、現在のサーバ・サイドのトレンドについて理解できるとともに、結果を本ブログで公開することで他の皆様にも有用な情報になるのではないかと想定しております。締め切り後に、再利用可能な結果(順位、投票数、パーセント)として公開します。
また、上記で「組み込みコンテナ(実行可能 jar)に移行済み」と回答した方のうち、どのフレームワークへ移行したかを教えていただけないでしょうか?移行していない場合は、下記にはお答えいただかなくて結構です。
本データは、日本全体における利用状況の実データにはならないと思いますし、市場調査会社がだす結果とは異なると思いますが、それでも Java コミュニティ参加者や、本ブログをご覧いただいている皆様の近辺のデータを集めることができるのではないかと想定しております。また、昨年のデータとの比較もできるかと思います。この1年で日本の状況は変わっているのでしょうか?とても楽しみにしています。
※ これは#てらだよしお 個人的なお願い事であり、所属企業や団体からの問い合わせではないことをご理解いただければ誠に幸いです。
冬はお部屋の温度・湿度に気をつけましょう!!
今日の福岡でのナイトセミナー(JAZUG福岡(ふくあず) 2017#1)のデモの最終調整を宿泊先のホテルでしています。今日のお話しも盛りだくさんなのでデモ内容をちょっとだけ先出したいと思います!!
頻繁に出張にいく私たちはホテルに宿泊する事が多いのですが、どのホテルもとても乾燥しています。そこで風邪をひかないように、お風呂場にお湯を張ったりして温度・湿度に気をつけたりしてます。
一般的に冬の湿度は40%-50%が最適?!(インフルエンザ・ウィルスも死滅?!)との事なので、ホテルの部屋の温度と湿度変化を、持ってきた Raspberry Pi の温度・湿度センサーを使って実際に測って 50% まであげてみました!!
Power Bi で温度・湿度データの変化をグラフ表示していますが、内部的には Raspberry Pi から取得したデータを、Azure IoT Hub に送信し、その後 Stream Analytics 経由でリアルタイムに Power Bi に送っています!!
最初の方で1回だけ突出して出ている波形は、温度・湿度センサーに直接手で触った時のデータです
Stream Analytics と Power Bi で簡単にこうしてリアルタイムのデータ変化を観れるのは嬉しいですね!!
よし!!これでこの部屋の湿度は最適になったぞ!!
Microsoft Tech Summit 開催(申し込み締め切りは明日まで)
来週、Microsoft Tech Summit が開催されますが、急遽私のセッション・タイトルとアジェンダを変更する事になりました。ただ今 Web サイトの修正依頼をしている状況でございます。
お申し込みの締め切りは明日 10月28日(金)まででございます。どうぞよろしくお願いします。
今回セッション調整により、私のセッションの横で、佐藤 直生 (@satonaoki) さんが、「Linux/Java にも対応! Azure Service Fabric を使ったマイクロサービス開発」というセッションをおこなう事になりました。Azure Service Fabric については、同じ時間帯で佐藤さんが詳しくご紹介いただける事になったため、かつ Pivotal Cloud Foundry が本日 GA になった事もあり、最新の情報をお届けするために、今回私は Pivotal Cloud Foundry on Azure の話しに集中することにしました。
また今回、急遽調整を行い Pivotal ジャパン株式会社の、槙さん(@making)をお招きして二人でセッションを行う事になりました。
タイトル:
「Pivotal Cloud Foundry on Azure で実現する Java マイクロサービス開発のご紹介」
アジェンダ:
2016 年 10 月 26 日(米国時間)Azure 対応の Pivotal Cloud Foundry が正式にリリースされました。これを記念して、本セッションは Pivotalジャパン株式会社をお招きしての特別セッションを開催します。
Pivotal Cloud Foundry は、世界的な企業で採用され、クラウド・ネィティブなプラットフォームとして、DevOps、マイクロサービスを実現するための便利な機能を提供しています。マイクロサービスを実現するための環境を、一から自分の手で作るには大変な労力や時間を要します。Pivotal Cloudn Foudry を利用することで、いち早くセキュリティに強いマイクロサービス・プラットフォームを利用することができるようになります。
本セッションは、Pivotal Cloud Foundry on Azure で、マイクロ・サービスを実現するための方法をデモを交えながらご紹介します。
追伸:
OpenShift も、すでに私の Azure 環境上で構築をしているのですが、Red Hat さんは、別途ご登壇いただきますし、近いうちに Red Hat さんと協業イベントを実施いたしますので、今回は Cloud Foundry に話しを絞る事にいたしました、どうぞご了承ください。
皆さまのお越しを楽しみにしております。
皆んな大好き Excel !! Excel REST API Java サンプルアプリケーション
2016 年 8 月初旬 Office 365 の Excel REST API が正式にリリースしました。
アナウンス:「Announcing the general availability of the Microsoft Excel API to expand the power of Office 365」
上記により、Graph API と呼ばれる REST API を使用して、Office 365 の OneDrive に存在する Excel ファイルを操作できるようになります。
Excel 操作用の Graph API
※ REST API で利用できるため、プログラミング言語を問わず任意の言語で操作ができるようになっていますので、Java 以外のプログラミング言語でもどうぞお試しください。
今回、私は上記の REST API を利用して Java のサンプル・コードを作成しました。
サンプル・コード:「GitHub : Office-365-Excel-REST-API-for-Java」
またサンプル・コードがどのように動作するのかをわかりやすくするため、サンプル・アプリケーションのデモ動画も撮りましたので、どうぞ下記のデモ動画もご覧ください。
今回作成したサンプル・アプリケーションは Java EE 7 のアプリケーションとして作成しました。そこで、Java EE 準拠のアプリケーション・サーバであれば、いずれの環境でも動作します。私は、Payara Server 4.1.1.162 (GlassFish) で動作確認をしていますが、少しの変更を行うだけで、アプリケーション・サーバではなく、Servlet Container(Tomcat/Jetty) でも動かすことができます。
追記:
Office 365 を無料でお試しいただく為の設定手順 (ステップ・バイ・ステップの画面ダンプ) や Tomcat 用の設定方法に関しては 「GitHub : README.md もしくは README-4-Tomcat.md」に記載しています。
アプリケーションの実装の詳細
このサンプル・アプリケーションは Java EE 7 で実装しています。
まず、GUI (フロントエンド) のビュー・テクノロジーとして JavaServer Faces (PirmeFaces) を利用しています。しかし、フロント技術はこのサンプルでは重要でありません。慣れ親しんだフロント・テクノロジーをご利用ください。
実際の、Excel 操作の要は、com.yoshio3.restclient パッケージ配下で実装しています。
特に com.yoshio3.restclient.services サービスが重要で、Excel REST API で用意されている各種機能(REST 呼び出し)をラッピングしたメソッドを実装しています。
また、Excel REST API のリクエスト・ボディ、もしくはレスポンス・ボディに含む JSON のデータは、すべて com.yoshio3.restclient.jaxb.entities パッケージ配下のクラスにマッピングしています。例えば、Excel のワーク・シートやテーブルを取得した際に取得できる情報はすべて com.yoshio3.restclient.jaxb.entities.excel パッケージに含まれています。このマッピングした Java オブジェクトを操作することで、実際の JSON データを意識せずにプログラムができます。
また、Office 365 に接続するためには、Azure Active Directory で認証を行う必要があります。今までは、「Microsoft Azure Active Directory Authentication Library (ADAL) for Java」を利用してきました。しかし、今回 Azure AD で認証を行うために必要最低限の軽量な Servlet Filter (AzureADAuthServletFilter) を独自に実装しました。
Servlet Filter : AzureADAuthServletFilter.java
アクセス・トークン:AccessToken.java
Auth サービス: OAuth2Service.java
まだ一部実装が足りない部分(TODO)はありますが、Azure AD の認証のフローをご理解頂く上で、このサーブレット・フィルタはご参考いただけるのではないかと思います。また、Servlet Filter なので認可はできませんが、Tomcat/Jetty のような Servlet Container でも動作します。認可が必要な方は、以前作成した「Azure AD 認証・認可サンプル」をご参照ください。
Java ユーザの皆様も、Office 365 の OneDrive に存在する Excel ファイルを直接 Java から操作してみませんか?
Have fan Excel with Java !!
Java EE の戦略アップデート (2016/08/09 : JCP Executive Committee)
2016/08/09 JCP の Executive Committee のミーティング (Executive Committee Meeting Minutes for August 9 2016) がありOracle の Java EE/WebLogic 系製品の責任者 (Oracle Group Vice President ) である Anil Gaur さんから、今後の Java EE の戦略に対する説明がされたようです。
※ Anil さんは、元 Sun で Java EE/GlassFish の開発チームをまとめていた方。
要約すると
* エンタープライズのプログラミング・スタイルが変わっている。
* 旧来のアプリケーション・サーバでは、複数のアプリが同一 アプリ上 アプリケーション・サーバで動いていたが、今は単一のサービスやアプリが、それ専用のモジュール化された実行環境でクラウド上にデプロイされている、Java EE をこうした次世代のアプリ開発に対応できるようにしたい。
* 新しいプログラミング・モデルは、大規模にスケールする分散アプリを構築するためにリアクティブ・スタイルのプログラミングを取り入れ疎結合化する必要がある。
* また、HTTP/2, 設定、状態管理、Eventual Consistency(結果整合性)、マルチテナンシー、O-Auth, OpenID Connect 対応にも注目している
* 現在は、Java EE の一部の大規模ベンダーに相談しているが、今後 Java Champion や Java ユーザ・グループにも相談する予定。
以降 EC メンバーとの Q&A
[Q] Werner Keil
Java SE プラットフォームは、今後リリース・サイクルを早めることを計画していると聞いていますが、このリリース・サイクルは Java EE にも当てはまりますか?
[A] Anil
Java SE とは切り離して考えてほしい。いくつかの機能は Java SE 8 をベースにするだろうし、Java SE 9 に依存する部分もあるでしょう。
[Q] Martijn Verburg
Microprofile.io のチームとコラボレートする計画はありますか?
[A] Anil
2つの計画が一緒になる事を期待したいと思います。Oracle は Red Hat にこの件について話し合いを持ちました。しかし現時点では明確な答えはありません。
[Q] Alex Blewitt
クラウド・ベースのプロビジョニングについて質問をします。クレディ・スイスは、非常に機密性の高いデータを持っているため、”クラウドではなくオンプレミスで実行したい
[A] Anil
Java EE 8 は後方互換性を壊すのではなく、オンプレミスでも動作するでしょう。今までと同様に、専門家グループがより広いコミュニティからのフィードバックを元に、リリースに関して最終的な範囲やパッケージングを決定するでしょう。
[Q] Mark Little
私は、Red Hat が Oracle と話し合いを持った事を確認しています。そして Red Hat は Microprofile.io でプロトタイプを実装する際に Oracle と協業したいと言っていました。
その他、Steve Wallin、Bruno Souza、Matt Schuetze などから追加の質問、意見が寄せられてました。詳しくは、下記原文をご参照。
以降、該当部分の原文を抜粋
Java EE strategy
Anil Gaur, Oracle Group Vice President with responsibility for Java EE and WebLogic Server, gave a brief verbal presentation on Oracle’s Java EE strategy. He noted that enterprise programming styles are changing – more and more applications are distributed in nature and get deployed in cloud environments. Rather than traditional appservers that typically run multiple applications, apps are now distributed and deployed in the Cloud via modular runtimes dedicated to a single application or service.We would like the future of Java EE to be viable to next generation of applications. These apps are composed and deployed differently in cloud and require flexibility, reliability and scale. The platform needs a new programming model that’s geared towards reactive style programming for building large-scale distributed applications that are loosely coupled. In addition, we would like to see HTTP/2, Config, State management, Eventual Consistency, Multi-tenancy, O-Auth and OpenID Connect get included in the platform. Oracle is talking to large Java EE vendors, and will soon consult with members of the community such as Java Champions and Java User Groups. He then asked for questions.
Werner Keil said that we had heard that Java SE would transition to faster release cycles. Would this also be reflected in Java EE? Anil replied that they intended to decouple from Java SE as best they could. Some features would be based on Java SE8 while others would depend on Java SE9.Martijn Verburg asked whether there were plans to collaborate with the Microprofile.io team. Anil responded that he would like to see the two efforts come together. Oracle has spoken to RedHat about this but there is no definitive answer yet.
Alex Blewitt asked about cloud-based provisioning, noting that Credit Suissse has some very sensitive data and would therefore want to run on-premise instead of “in the cloud”. Anil responded that Java EE8 will not break backward compatibility and noted that it will be possible to run Java EE8 on-premise. As always, the Expert Group will decide the final scope and packaging of the release with input from broader community.
Mark Little confirmed that RedHat has spoken to Oracle, and said that he hoped that they could collaborate, perhaps by prototyping at Microprofile.io.
Steve Wallin said that IBM has also had discussions with Oracle. He asked whether Oracle was considering a completely new platform. Anil responded that he doesn’t want to pre-judge this; the community must decide. Steve asked what was missing from the current platform, noting that IBM has been able to deliver rapid deployment based on the existing platform. He thanked Anil for coming to speak to the EC.
Bruno Souza said that Java EE has historically been very open and participative – more so than other platforms – and consequently had been very good for the JCP. Going quiet for a year was very unhealthy and had damaged Java. He hoped that this would not happen again.
Anil said he understood. Oracle intends to work with the community and the JCP. They want to deliver something that developers will find useful and exciting.
Werner Keil asked when Java EE8 would be released. Anil said that the planned date will change, but he doesn’t yet have the details. He expects to be able to say at JavaOne.Bruno asked whether Java User Groups and the Adopt-a-JSR program could help. Anil said he would welcome such community involvement.
Matt Schuetze asked what the high-level message is. Anil said that Java EE will continue to evolve. Some features will be more revolutionary, but exactly how things will be packaged has not yet been decided.
Werner Keil noted that java.net is being decommissioned and asked where Java EE projects will be hosted. Anil agreed that they would be impacted by this change and that they are evaluating alternatives.There being no further questions, Patrick thanked Anil for coming to talk to the EC. Anil responded that he expected to reach out to many EC members in the coming weeks.
Microsoft Cognitive サービスによる OCR 解析
マイクロソフトの Cognitive サービスには OCR (光学式文字認識:画像に含まれる文字列をテキストデータとして抽出) の機能があります。現在はプレビュー版としてこの機能が提供されています。
Cognitive Services : Computer Vision API – v1.0 OCR
● Java のサンプル・アプリケーションについて
JAX-RS Client API を使って、Java の OCR サンプルを作り下記に公開しました。ご興味ある方はお試しください。
https://github.com/yoshioterada/OCR-Sample-of-Cognitive-Service
※ 本プログラムをお試しいただくためには、Subscription ID を入手して頂く必要があります。コチラ(Cognitive Services Computer Vision)より「Get started for free」のボタンを押し「Computer Vision – Preview 5,000 transactions per month, 20 per minute. 」にチェックし「Subscribe」ボタンを押して「Subscription ID」を入手してください。入手した ID を、プログラム中の SUBSCRIPTION_ID に記載してください。
画像は、以下の3種類の方法で指定できます。
1. 画像が置かれている URI を指定
2. ローカル・ディレクトリを含む絶対パスでファイル名を指定
3. 画像の byte[] を指定
public class Main { private final static String SUBSCRIPTION_ID = "*******************************************"; public static void main(String argv[]) { OCRService service = new OCRService(SUBSCRIPTION_ID); // GET the result of OCR from specified URI String pictURI = "http://businessnetwork.jp/Portals/0/SP2016/PSTN/img/1604_microsoft_top.jpg"; Optional<OCRResponseJSONBody> result = service.getOCRAnalysisResult(pictURI); result.ifPresent(resultBody -> service.printOCRResult(resultBody)); //GET the result of OCR from the local file try { Optional<OCRResponseJSONBody> result2 = service.getOCRAnalysisResult(Paths.get("/Users/terada/Downloads/aaa.jpeg")); result2.ifPresent(resultBody -> service.printOCRResult(resultBody)); } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } }
下記に、本プログラムを利用した解析結果の例をご紹介します。
●解析結果例1
まず、解析結果として、とてもうまくいった例をご紹介します。例として、sansan さんのサンプル名刺を利用させていただきました。
解析したらこんな結果が得られました。完全に一致していますね!!
//embedr.flickr.com/assets/client-code.js
●解析結果例2
次に私の名刺を解析しました(メールと電話番号だけ伏せさせてください)。
//embedr.flickr.com/assets/client-code.js
その結果、こうなりました。
//embedr.flickr.com/assets/client-code.js
「Microsoft」が「Mi(「0S0升」、「Blog」が「引log」になっています。どうやら、現時点で日本語と英語がまざると、日本語解析が英語解析より優先度強くはたらき、ローマ字に似た日本語の文字を当てはめるみたいです。例えば「@yoshioterada」が「yoshiote「ada」と解析された場合もあります。
●日英がまざる場合の現時点の回避策
現時点では(ワークアラウンドとして)、日本語解析と英語解析を2度実行し有効な文字列を抽出するのが良いのではないかと思っています。
実際に、OCR 処理用の REST URL は下記になります。
https://api.projectoxford.ai/vision/v1.0/ocr?language=en&detectOrientation=true”
ここで引数に language を指定しますが、language=en,language=ja で、それぞれ英語か日本語の解析を切り替えます。日英両方を含む場合、現時点のワークアラウンドとして、”en” と “ja” の2回解析し、取得結果から意味的に有効な方を使うというのも良いかもしれません。
実際に、language=en を指定し、英語解析で名刺を解析させると、下記のように「Mi(「0S0升」と解析されていた箇所も正しく「Microsoft」と、そして「Blog」も正しく解析できていました。
//embedr.flickr.com/assets/client-code.js
REST の呼び出し結果(JSON)を確認すると1文字ずつ文字を抽出し認識しているようです。1行単位(つまり文字の前後関係)では解析はしていないので、1行を抜き出し本当に意味のある正しい文字列になっているかどうかを判定するような処理を入れれば精度はあがるのではないかと思います。(例えば「Mi(「0S0升」や「引log」のように1行中に1バイト文字と2バイト文字が混合しているなどはおかしい可能性が高いです。あと o(オー) と 0(ゼロ) も間違える場合があります。さらに l(エル), I(大文字のアイ), 1(イチ)も同様です。 怪しい場合には Bing の検索 API で探すという手もありかもしれません。)
こちらについては、Java に限らずどの言語を利用しても同じ結果が得られると想定しますので、本国の開発チームには多言語対応への課題としてフィードバックしたいと思っています。
まだプレビュー版ですが、1月辺り 5,000 処理、もしくは1分間辺り 20 処理までは無料でご利用いただけます。どうぞお試し版(プレビュー)としてご利用ください。